Re: [PATCH v3 3/3] iio: magnetometer: add ti tmag5273 driver

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

 



On Fri, Nov 25, 2022 at 12:59:01PM +0200, Andy Shevchenko wrote:
> On Fri, Nov 25, 2022 at 09:35:26AM +0100, Gerald Loacker wrote:

...

> > +static int tmag5273_write_scale(struct tmag5273_data *data, int scale_micro)
> > +{
> 
> What about
> 
> 	u32 mask;

After looking again, I guess it should be

	u32 value;

> > +	int i;
> > +
> > +	for (i = 0; i < ARRAY_SIZE(tmag5273_scale[0]); i++) {
> > +		if (tmag5273_scale[data->version][i].val_micro == scale_micro)
> > +			break;
> > +	}
> > +	if (i == ARRAY_SIZE(tmag5273_scale[0]))
> > +		return -EINVAL;
> > +	data->scale_index = i;
> 
> 	if (data->scale_index == MAGN_RANGE_LOW)
> 		mask = 0;
> 	else
> 		mask = TMAG5273_Z_RANGE_MASK | TMAG5273_X_Y_RANGE_MASK;
> 
> > +	return regmap_update_bits(data->map,
> > +		TMAG5273_SENSOR_CONFIG_2,
> > +		TMAG5273_Z_RANGE_MASK | TMAG5273_X_Y_RANGE_MASK,
> 
> 		mask);
> 
> > +		data->scale_index == MAGN_RANGE_LOW ? 0 :
> > +			TMAG5273_Z_RANGE_MASK |
> > +			TMAG5273_X_Y_RANGE_MASK);
> 
> ?
> 
> > +}

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux