Re: [PATCHv3 5/5] misc: gehc-achc: new driver

From: Mark Brown
Date: Wed Jun 09 2021 - 08:42:31 EST


On Fri, May 28, 2021 at 01:33:47PM +0200, Sebastian Reichel wrote:

> drivers/misc/Kconfig | 15 +
> drivers/misc/Makefile | 2 +
> drivers/misc/gehc-achc.c | 160 ++++++++
> drivers/misc/nxp-ezport.c | 476 +++++++++++++++++++++++
> drivers/spi/spidev.c | 7 +-
> include/linux/platform_data/nxp-ezport.h | 9 +
> include/linux/spi/spi.h | 5 +

This clearly seems to be something that should be split into separate
patches, even without getting as far as the code it's hard to see how
changes to spidev.c wouldn't be standalone changes that should be split
out from what looks like adding two new drivers.

> +static int gehc_achc_probe(struct spi_device *spi)
> +{

...

> + ret = spidev_probe(spi);
> + if (ret)
> + return ret;

This isn't integrated at all with the flashing code, userspace might be
trying to do something with the device while flashing happens. I would
expect at a very minimum that we'd be hot unplugging the spidev while
the flashing is in progress.

> -static int spidev_probe(struct spi_device *spi)
> +int spidev_probe(struct spi_device *spi)
> {
> struct spidev_data *spidev;
> int status;
> @@ -789,8 +788,9 @@ static int spidev_probe(struct spi_device *spi)
>
> return status;
> }
> +EXPORT_SYMBOL_GPL(spidev_probe);

This really looks like a very, very bad idea in general - attempting to
combine the unmediated userspace access that spidev offers with an in
kernel driver seems like it's not going to go well, as with the flashing
issue. Really this looks like two marginally related devices that are
getting glued together which is abot the best case for this being
supportable and even then it'd need more work. I'm not keen about
providing the interface at all as it's the sort of thing people are
going to get wrong a bunch.

Attachment: signature.asc
Description: PGP signature