diff mbox series

[v3,1/3] i2c: mux: pca954x: remove support for unused platform data

Message ID 20190225155105.19378-2-robertshearman@gmail.com
State Superseded
Headers show
Series i2c: mux: pca954x: allow management of device idle state via sysfs | expand

Commit Message

Robert Shearman Feb. 25, 2019, 3:51 p.m. UTC
From: Robert Shearman <robert.shearman@att.com>

There are no in-tree users of the pca954x platform data and the
per-channel deselect configuration complicates efforts to export the
configuration to user-space in a way that could be applied to other
muxes. Therefore, remove support for the pca954x platform data.

Signed-off-by: Robert Shearman <robert.shearman@att.com>
---
 drivers/i2c/muxes/i2c-mux-pca954x.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

Comments

Peter Rosin Feb. 26, 2019, 11:53 a.m. UTC | #1
On 2019-02-25 16:51, Robert Shearman wrote:
> From: Robert Shearman <robert.shearman@att.com>
> 
> There are no in-tree users of the pca954x platform data and the
> per-channel deselect configuration complicates efforts to export the
> configuration to user-space in a way that could be applied to other
> muxes. Therefore, remove support for the pca954x platform data.
> 
> Signed-off-by: Robert Shearman <robert.shearman@att.com>
> ---
>  drivers/i2c/muxes/i2c-mux-pca954x.c | 17 +----------------
>  1 file changed, 1 insertion(+), 16 deletions(-)
> 
> diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
> index bfabf985e830..5005bba8c72c 100644
> --- a/drivers/i2c/muxes/i2c-mux-pca954x.c
> +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
> @@ -46,7 +46,6 @@
>  #include <linux/of.h>
>  #include <linux/of_device.h>
>  #include <linux/of_irq.h>
> -#include <linux/platform_data/pca954x.h>
>  #include <linux/pm.h>
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
> @@ -348,7 +347,6 @@ static int pca954x_probe(struct i2c_client *client,
>  			 const struct i2c_device_id *id)
>  {
>  	struct i2c_adapter *adap = client->adapter;
> -	struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev);
>  	struct device *dev = &client->dev;
>  	struct device_node *np = dev->of_node;
>  	bool idle_disconnect_dt;
> @@ -422,22 +420,9 @@ static int pca954x_probe(struct i2c_client *client,
>  
>  	/* Now create an adapter for each channel */
>  	for (num = 0; num < data->chip->nchans; num++) {
> -		bool idle_disconnect_pd = false;
> -
>  		force = 0;			  /* dynamic adap number */
>  		class = 0;			  /* no class by default */

These two "variables" are now always zero and can be removed and replaced
with hard-coded zeros...

> -		if (pdata) {
> -			if (num < pdata->num_modes) {
> -				/* force static number */
> -				force = pdata->modes[num].adap_id;
> -				class = pdata->modes[num].class;
> -			} else
> -				/* discard unconfigured channels */
> -				break;
> -			idle_disconnect_pd = pdata->modes[num].deselect_on_exit;
> -		}
> -		data->deselect |= (idle_disconnect_pd ||
> -				   idle_disconnect_dt) << num;
> +		data->deselect |= idle_disconnect_dt << num;
>  
>  		ret = i2c_mux_add_adapter(muxc, force, num, class);

...here. Can you perhaps fix that too while at it? A similar thing can
be done in the PCA9541 driver.

Let me know if you're fed up with the series as this could theoretically
be fixed later, but I'd rather do it directly...

Cheers,
Peter

>  		if (ret)
>
Robert Shearman Feb. 27, 2019, 5:38 p.m. UTC | #2
On 26/02/2019 11:53, Peter Rosin wrote:
> On 2019-02-25 16:51, Robert Shearman wrote:
>> From: Robert Shearman <robert.shearman@att.com>
>>
>> There are no in-tree users of the pca954x platform data and the
>> per-channel deselect configuration complicates efforts to export the
>> configuration to user-space in a way that could be applied to other
>> muxes. Therefore, remove support for the pca954x platform data.
>>
>> Signed-off-by: Robert Shearman <robert.shearman@att.com>
>> ---
>>   drivers/i2c/muxes/i2c-mux-pca954x.c | 17 +----------------
>>   1 file changed, 1 insertion(+), 16 deletions(-)
>>
>> diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
>> index bfabf985e830..5005bba8c72c 100644
>> --- a/drivers/i2c/muxes/i2c-mux-pca954x.c
>> +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
>> @@ -46,7 +46,6 @@
>>   #include <linux/of.h>
>>   #include <linux/of_device.h>
>>   #include <linux/of_irq.h>
>> -#include <linux/platform_data/pca954x.h>
>>   #include <linux/pm.h>
>>   #include <linux/slab.h>
>>   #include <linux/spinlock.h>
>> @@ -348,7 +347,6 @@ static int pca954x_probe(struct i2c_client *client,
>>   			 const struct i2c_device_id *id)
>>   {
>>   	struct i2c_adapter *adap = client->adapter;
>> -	struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev);
>>   	struct device *dev = &client->dev;
>>   	struct device_node *np = dev->of_node;
>>   	bool idle_disconnect_dt;
>> @@ -422,22 +420,9 @@ static int pca954x_probe(struct i2c_client *client,
>>   
>>   	/* Now create an adapter for each channel */
>>   	for (num = 0; num < data->chip->nchans; num++) {
>> -		bool idle_disconnect_pd = false;
>> -
>>   		force = 0;			  /* dynamic adap number */
>>   		class = 0;			  /* no class by default */
> 
> These two "variables" are now always zero and can be removed and replaced
> with hard-coded zeros...
> 
>> -		if (pdata) {
>> -			if (num < pdata->num_modes) {
>> -				/* force static number */
>> -				force = pdata->modes[num].adap_id;
>> -				class = pdata->modes[num].class;
>> -			} else
>> -				/* discard unconfigured channels */
>> -				break;
>> -			idle_disconnect_pd = pdata->modes[num].deselect_on_exit;
>> -		}
>> -		data->deselect |= (idle_disconnect_pd ||
>> -				   idle_disconnect_dt) << num;
>> +		data->deselect |= idle_disconnect_dt << num;
>>   
>>   		ret = i2c_mux_add_adapter(muxc, force, num, class);
> 
> ...here. Can you perhaps fix that too while at it? A similar thing can
> be done in the PCA9541 driver.
> 
> Let me know if you're fed up with the series as this could theoretically
> be fixed later, but I'd rather do it directly...

Not a problem - consider it done.

Thanks,
Rob

> 
> Cheers,
> Peter
> 
>>   		if (ret)
>>
>
diff mbox series

Patch

diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index bfabf985e830..5005bba8c72c 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -46,7 +46,6 @@ 
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
-#include <linux/platform_data/pca954x.h>
 #include <linux/pm.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -348,7 +347,6 @@  static int pca954x_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
 	struct i2c_adapter *adap = client->adapter;
-	struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev);
 	struct device *dev = &client->dev;
 	struct device_node *np = dev->of_node;
 	bool idle_disconnect_dt;
@@ -422,22 +420,9 @@  static int pca954x_probe(struct i2c_client *client,
 
 	/* Now create an adapter for each channel */
 	for (num = 0; num < data->chip->nchans; num++) {
-		bool idle_disconnect_pd = false;
-
 		force = 0;			  /* dynamic adap number */
 		class = 0;			  /* no class by default */
-		if (pdata) {
-			if (num < pdata->num_modes) {
-				/* force static number */
-				force = pdata->modes[num].adap_id;
-				class = pdata->modes[num].class;
-			} else
-				/* discard unconfigured channels */
-				break;
-			idle_disconnect_pd = pdata->modes[num].deselect_on_exit;
-		}
-		data->deselect |= (idle_disconnect_pd ||
-				   idle_disconnect_dt) << num;
+		data->deselect |= idle_disconnect_dt << num;
 
 		ret = i2c_mux_add_adapter(muxc, force, num, class);
 		if (ret)