Re: [PATCH] iio: accel: add Freescale MMA7455L 3-axis accelerometer driver

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

 



On 19 October 2015 at 14:23, Lars-Peter Clausen <lars@xxxxxxxxxx> wrote:
> On 10/19/2015 02:19 PM, Joachim Eastwood wrote:
>>>> +static int __init mma7455_modinit(void)
>>>> +{
>>>> +     int ret;
>>>> +#if IS_ENABLED(CONFIG_I2C)
>>>> +     ret = i2c_add_driver(&mma7455_i2c_driver);
>>>> +     if (ret)
>>>> +             pr_err("failed to register MMA7455L I2C driver: %d\n", ret);
>>>> +#endif
>>>> +#if IS_ENABLED(CONFIG_SPI_MASTER)
>>>> +     ret = spi_register_driver(&mma7455_spi_driver);
>>>> +     if (ret)
>>>> +             pr_err("failed to register MMA7455L SPI driver: %d\n", ret);
>>>> +#endif
>>>
>>> I know there are a fair amount of bad examples in the IIO tree for this,
>>> which do the same thing. But the SPI and the I2C parts should go into
>>> different modules, otherwise you run into issues if one of them is built-in
>>> while the other is built as a module. The bmg160 gyro driver is a good
>>> example on how to do handle this.
>>
>> Ok, I semi-copied from a ASoC CODEC driver. I'll take a look at how
>> bmg160 handles it.
>
> We deprecated this style in ASoC as well. All new drivers that support both
> SPI and I2C always come with a foobar-spi.c and foobar-i2c.c file. Not all
> drivers have been updated to this new scheme yet, but I think the majority
> follows it by now.

I see.

Only one of the Wolfson CODEC drivers has been split this way in Linus
master it seems and it was one of these I took as a template.


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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux