Re: [PATCH 2/2] gpio: pca9570: add slg7xl45106 support

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

 



On 17/08/2022 11:55, Shubhrajyoti Datta wrote:
> slg7xl45106 is a I2C GPO expander.
> Add a compatible string for the same. Also update the
> driver to write and read from it.

Please fix your wrapping to match coding style.

> 

>  
> @@ -94,6 +100,7 @@ static void pca9570_set(struct gpio_chip *chip, unsigned int offset, int value)
>  static int pca9570_probe(struct i2c_client *client)
>  {
>  	struct pca9570 *gpio;
> +	struct device_node *np = client->dev.of_node;
>  
>  	gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL);
>  	if (!gpio)
> @@ -109,6 +116,9 @@ static int pca9570_probe(struct i2c_client *client)
>  	gpio->chip.ngpio = (uintptr_t)device_get_match_data(&client->dev);
>  	gpio->chip.can_sleep = true;
>  
> +	if (of_device_is_compatible(np, "dlg,slg7xl45106"))

Matching is done once and you have driver data for this. No compatibles
in the code, this does not scale.

> +		gpio->command = SLG7XL45106_GPO_REG;
> +
>  	mutex_init(&gpio->lock);
>  
>  	/* Read the current output level */
> @@ -121,12 +131,14 @@ static int pca9570_probe(struct i2c_client *client)
>  
>  static const struct i2c_device_id pca9570_id_table[] = {
>  	{ "pca9570", 4 },
> +	{ "slg7xl45106", 8 },
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(i2c, pca9570_id_table);
>  
>  static const struct of_device_id pca9570_of_match_table[] = {
>  	{ .compatible = "nxp,pca9570", .data = (void *)4 },

This is some old tree, isn't it?

> +	{ .compatible = "dlg,slg7xl45106", .data = (void *)8 },
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, pca9570_of_match_table);


Best regards,
Krzysztof



[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