Re: [PATCH 4/4] Input: mms114 - add support for mms152

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 24, 2018 at 09:04:08PM +0100, Marcus Folkesson wrote:
> Hello Dmitry,
> 
> On Wed, Jan 24, 2018 at 11:38:04AM -0800, Dmitry Torokhov wrote:
> > From: Simon Shields <simon@xxxxxxxxxxxxx>
> > 
> > @@ -241,12 +251,28 @@ static int mms114_get_version(struct mms114_data *data)
> >  	u8 buf[6];
> >  	int error;
> >  
> > -	error = __mms114_read_reg(data, MMS114_TSP_REV, 6, buf);
> > -	if (error < 0)
> > -		return error;
> > +	switch (data->type) {
> > +	case TYPE_MMS152:
> > +		error = __mms114_read_reg(data, MMS152_FW_REV, 3, buf);
> > +		if (error)
> > +			return error;
> > +		buf[3] = i2c_smbus_read_byte_data(data->client,
> > +						  MMS152_COMPAT_GROUP);
> > +		if (buf[3] < 0)
> > +			return buf[3];
> 
> buf is unsigned.
> 
> Maybe
> 		error = i2c_smbus_read_byte_data(data->client,
> 						  MMS152_COMPAT_GROUP);
> 		if (error < 0)
> 			return error;
> Instead?

Good catch. I think I'd rather have a separate variable "group" for
this.

Thank you.

> 
> 
> > +		dev_info(dev, "TSP FW Rev: bootloader 0x%x / core 0x%x / config 0x%x, Compat group: %c\n",
> > +			 buf[0], buf[1], buf[2], buf[3]);
> > +		break;
> > +
> > +	case TYPE_MMS114:
> > +		error = __mms114_read_reg(data, MMS114_TSP_REV, 6, buf);
> > +		if (error)
> > +			return error;
> >  
> > -	dev_info(dev, "TSP Rev: 0x%x, HW Rev: 0x%x, Firmware Ver: 0x%x\n",
> > -		 buf[0], buf[1], buf[3]);
> > +		dev_info(dev, "TSP Rev: 0x%x, HW Rev: 0x%x, Firmware Ver: 0x%x\n",
> > +			 buf[0], buf[1], buf[3]);
> > +		break;
> > +	}
> >  
> >  	return 0;
> >  }
> 
> 
> Best regards
> Marcus Folkesson



-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux