Re: [PATCH 2/2] misc: bm92txx: Add driver for the ROHM BM92Txx
From: Greg Kroah-Hartman
Date: Thu Aug 24 2023 - 11:41:06 EST
On Thu, Aug 24, 2023 at 05:30:54PM +0200, Emmanuel Gil Peyrot wrote:
> From: azkali <a.ffcc7@xxxxxxxxx>
>
> This is used as the USB-C Power Delivery controller of the Nintendo
> Switch.
>
> Signed-off-by: Emmanuel Gil Peyrot <linkmauve@xxxxxxxxxxxx>
> Signed-off-by: azkali <a.ffcc7@xxxxxxxxx>
> Signed-off-by: Adam Jiang <chaoj@xxxxxxxxxx>
> Signed-off-by: CTCaer <ctcaer@xxxxxxxxx>
> ---
> MAINTAINERS | 1 +
> drivers/misc/Kconfig | 11 +
> drivers/misc/Makefile | 1 +
> drivers/misc/bm92txx.c | 2403 ++++++++++++++++++++++++++++++++++++++++
Why here and not in drivers/usb/typec/ ?
> 4 files changed, 2416 insertions(+)
> create mode 100644 drivers/misc/bm92txx.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index cc100a02fa7b..fe80d7693944 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -18457,6 +18457,7 @@ ROHM USB-C POWER DELIVERY CONTROLLERS
> M: Emmanuel Gil Peyrot <linkmauve@xxxxxxxxxxxx>
> S: Supported
> F: Documentation/devicetree/bindings/misc/rohm,bm92txx.yaml
> +F: drivers/misc/bm92txx.c
>
> ROSE NETWORK LAYER
> M: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> index 75e427f124b2..a2483819766a 100644
> --- a/drivers/misc/Kconfig
> +++ b/drivers/misc/Kconfig
> @@ -561,6 +561,17 @@ config TPS6594_PFSM
> This driver can also be built as a module. If so, the module
> will be called tps6594-pfsm.
>
> +config BM92TXX
> + tristate "Rohm Semiconductor BM92TXX USB Type-C Support"
> + depends on I2C=y
Why =y? That shouldn't matter, can't this just read:
depends on I2C
> +static int bm92t_read_reg(struct bm92t_info *info,
> + unsigned char reg, unsigned char *buf, int num)
> +{
> + struct i2c_msg xfer_msg[2];
> + int err;
> + unsigned char reg_addr;
> +
> + reg_addr = reg;
> +
> + xfer_msg[0].addr = info->i2c_client->addr;
> + xfer_msg[0].len = 1;
> + xfer_msg[0].flags = 0;
> + xfer_msg[0].buf = ®_addr;
> +
> + xfer_msg[1].addr = info->i2c_client->addr;
> + xfer_msg[1].len = num;
> + xfer_msg[1].flags = I2C_M_RD;
> + xfer_msg[1].buf = buf;
> +
> + err = i2c_transfer(info->i2c_client->adapter, xfer_msg, 2);
> + if (err < 0)
> + dev_err(&info->i2c_client->dev, "%s: transfer error %d\n", __func__, err);
There shouldn't be a need to put __func__ in a dev_*() call.
And why not use the device you have here, not the i2c client device?
Isn't the platform device the "correct" one that had the error?
thanks,
greg k-h