Re: [PATCH 3/9] iio: accel: bmc150: add mount matrix support
From: H. Nikolaus Schaller
Date: Wed Feb 20 2019 - 11:14:50 EST
> Am 20.02.2019 um 17:07 schrieb Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>:
>
> On Wed, Feb 20, 2019 at 03:00:50PM +0100, H. Nikolaus Schaller wrote:
>> This patch allows to read a mount-matrix device tree
>> property and report to user-space or in-kernel iio
>> clients.
>
>> +static const struct iio_mount_matrix *
>> +bmc150_accel_get_mount_matrix(const struct iio_dev *indio_dev,
>> + const struct iio_chan_spec *chan)
>> +{
>> + return &((struct bmc150_accel_data *)iio_priv(indio_dev))->orientation;
>
> It's hard to read.
>
> Can you split such lines in your series to something like
>
> struct bmc150_accel_data *data = iio_priv(indio_dev);
>
> return &data->orientation;
>
> ?
I think I did copy it verbatim from some other iio driver:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/iio/magnetometer/ak8975.c?h=next-20190220#n745
and checkpatch did not complain.
But yes, it can and should be improved since it seems that
I picked the only bad example as template...
>
>> +}
>> +
>> +static const struct iio_chan_spec_ext_info bmc150_accel_ext_info[] = {
>> + IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, bmc150_accel_get_mount_matrix),
>> + { },
>
> Terminator lines better without comma.
Ok.
>
>> +};
>
> --
> With Best Regards,
> Andy Shevchenko
>
>