[3/3] w1: gpio: rename pointer to driver data from pdata to ddata

Message ID 20230525095624.615350-3-u.kleine-koenig@pengutronix.de
State New
Headers
Series [1/3] w1: gpio: Don't use platform data for driver data |

Commit Message

Uwe Kleine-König May 25, 2023, 9:56 a.m. UTC
  pdata is a relict when this was still platform data.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/w1/masters/w1-gpio.c | 54 ++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 27 deletions(-)
  

Comments

kernel test robot May 25, 2023, 9:55 p.m. UTC | #1
Hi Uwe,

kernel test robot noticed the following build errors:

[auto build test ERROR on ac9a78681b921877518763ba0e89202254349d1b]

url:    https://github.com/intel-lab-lkp/linux/commits/Uwe-Kleine-K-nig/w1-gpio-Drop-unused-enable_external_pullup-from-driver-data/20230525-180131
base:   ac9a78681b921877518763ba0e89202254349d1b
patch link:    https://lore.kernel.org/r/20230525095624.615350-3-u.kleine-koenig%40pengutronix.de
patch subject: [PATCH 3/3] w1: gpio: rename pointer to driver data from pdata to ddata
config: i386-randconfig-i094-20230525
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        mkdir -p ~/bin
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/898f3f43b021ad2f7960ffddb814ef5cf1e2753d
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Uwe-Kleine-K-nig/w1-gpio-Drop-unused-enable_external_pullup-from-driver-data/20230525-180131
        git checkout 898f3f43b021ad2f7960ffddb814ef5cf1e2753d
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/w1/masters/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202305260541.tUXULCW2-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/w1/masters/w1-gpio.c:84:43: error: use of undeclared identifier 'pdata'; did you mean 'ddata'?
           ddata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
                                                    ^~~~~
                                                    ddata
   drivers/w1/masters/w1-gpio.c:77:24: note: 'ddata' declared here
           struct w1_gpio_ddata *ddata;
                                 ^
   1 error generated.


vim +84 drivers/w1/masters/w1-gpio.c

    73	
    74	static int w1_gpio_probe(struct platform_device *pdev)
    75	{
    76		struct w1_bus_master *master;
    77		struct w1_gpio_ddata *ddata;
    78		struct device *dev = &pdev->dev;
    79		struct device_node *np = dev->of_node;
    80		/* Enforce open drain mode by default */
    81		enum gpiod_flags gflags = GPIOD_OUT_LOW_OPEN_DRAIN;
    82		int err;
    83	
  > 84		ddata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
    85		if (!ddata)
    86			return -ENOMEM;
    87	
    88		/*
    89		 * This parameter means that something else than the gpiolib has
    90		 * already set the line into open drain mode, so we should just
    91		 * driver it high/low like we are in full control of the line and
    92		 * open drain will happen transparently.
    93		 */
    94		if (of_property_present(np, "linux,open-drain"))
    95			gflags = GPIOD_OUT_LOW;
    96	
    97		master = devm_kzalloc(dev, sizeof(struct w1_bus_master),
    98				GFP_KERNEL);
    99		if (!master)
   100			return -ENOMEM;
   101	
   102		ddata->gpiod = devm_gpiod_get_index(dev, NULL, 0, gflags);
   103		if (IS_ERR(ddata->gpiod)) {
   104			dev_err(dev, "gpio_request (pin) failed\n");
   105			return PTR_ERR(ddata->gpiod);
   106		}
   107	
   108		ddata->pullup_gpiod =
   109			devm_gpiod_get_index_optional(dev, NULL, 1, GPIOD_OUT_LOW);
   110		if (IS_ERR(ddata->pullup_gpiod)) {
   111			dev_err(dev, "gpio_request_one "
   112				"(ext_pullup_enable_pin) failed\n");
   113			return PTR_ERR(ddata->pullup_gpiod);
   114		}
   115	
   116		master->data = ddata;
   117		master->read_bit = w1_gpio_read_bit;
   118		gpiod_direction_output(ddata->gpiod, 1);
   119		master->write_bit = w1_gpio_write_bit;
   120	
   121		/*
   122		 * If we are using open drain emulation from the GPIO library,
   123		 * we need to use this pullup function that hammers the line
   124		 * high using a raw accessor to provide pull-up for the w1
   125		 * line.
   126		 */
   127		if (gflags == GPIOD_OUT_LOW_OPEN_DRAIN)
   128			master->set_pullup = w1_gpio_set_pullup;
   129	
   130		err = w1_add_master_device(master);
   131		if (err) {
   132			dev_err(dev, "w1_add_master device failed\n");
   133			return err;
   134		}
   135	
   136		if (ddata->pullup_gpiod)
   137			gpiod_set_value(ddata->pullup_gpiod, 1);
   138	
   139		platform_set_drvdata(pdev, master);
   140	
   141		return 0;
   142	}
   143
  

Patch

diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
index 67596428f69b..0956ea857226 100644
--- a/drivers/w1/masters/w1-gpio.c
+++ b/drivers/w1/masters/w1-gpio.c
@@ -25,25 +25,25 @@  struct w1_gpio_ddata {
 
 static u8 w1_gpio_set_pullup(void *data, int delay)
 {
-	struct w1_gpio_ddata *pdata = data;
+	struct w1_gpio_ddata *ddata = data;
 
 	if (delay) {
-		pdata->pullup_duration = delay;
+		ddata->pullup_duration = delay;
 	} else {
-		if (pdata->pullup_duration) {
+		if (ddata->pullup_duration) {
 			/*
 			 * This will OVERRIDE open drain emulation and force-pull
 			 * the line high for some time.
 			 */
-			gpiod_set_raw_value(pdata->gpiod, 1);
-			msleep(pdata->pullup_duration);
+			gpiod_set_raw_value(ddata->gpiod, 1);
+			msleep(ddata->pullup_duration);
 			/*
 			 * This will simply set the line as input since we are doing
 			 * open drain emulation in the GPIO library.
 			 */
-			gpiod_set_value(pdata->gpiod, 1);
+			gpiod_set_value(ddata->gpiod, 1);
 		}
-		pdata->pullup_duration = 0;
+		ddata->pullup_duration = 0;
 	}
 
 	return 0;
@@ -51,16 +51,16 @@  static u8 w1_gpio_set_pullup(void *data, int delay)
 
 static void w1_gpio_write_bit(void *data, u8 bit)
 {
-	struct w1_gpio_ddata *pdata = data;
+	struct w1_gpio_ddata *ddata = data;
 
-	gpiod_set_value(pdata->gpiod, bit);
+	gpiod_set_value(ddata->gpiod, bit);
 }
 
 static u8 w1_gpio_read_bit(void *data)
 {
-	struct w1_gpio_ddata *pdata = data;
+	struct w1_gpio_ddata *ddata = data;
 
-	return gpiod_get_value(pdata->gpiod) ? 1 : 0;
+	return gpiod_get_value(ddata->gpiod) ? 1 : 0;
 }
 
 #if defined(CONFIG_OF)
@@ -74,15 +74,15 @@  MODULE_DEVICE_TABLE(of, w1_gpio_dt_ids);
 static int w1_gpio_probe(struct platform_device *pdev)
 {
 	struct w1_bus_master *master;
-	struct w1_gpio_ddata *pdata;
+	struct w1_gpio_ddata *ddata;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	/* Enforce open drain mode by default */
 	enum gpiod_flags gflags = GPIOD_OUT_LOW_OPEN_DRAIN;
 	int err;
 
-	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata)
+	ddata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!ddata)
 		return -ENOMEM;
 
 	/*
@@ -99,23 +99,23 @@  static int w1_gpio_probe(struct platform_device *pdev)
 	if (!master)
 		return -ENOMEM;
 
-	pdata->gpiod = devm_gpiod_get_index(dev, NULL, 0, gflags);
-	if (IS_ERR(pdata->gpiod)) {
+	ddata->gpiod = devm_gpiod_get_index(dev, NULL, 0, gflags);
+	if (IS_ERR(ddata->gpiod)) {
 		dev_err(dev, "gpio_request (pin) failed\n");
-		return PTR_ERR(pdata->gpiod);
+		return PTR_ERR(ddata->gpiod);
 	}
 
-	pdata->pullup_gpiod =
+	ddata->pullup_gpiod =
 		devm_gpiod_get_index_optional(dev, NULL, 1, GPIOD_OUT_LOW);
-	if (IS_ERR(pdata->pullup_gpiod)) {
+	if (IS_ERR(ddata->pullup_gpiod)) {
 		dev_err(dev, "gpio_request_one "
 			"(ext_pullup_enable_pin) failed\n");
-		return PTR_ERR(pdata->pullup_gpiod);
+		return PTR_ERR(ddata->pullup_gpiod);
 	}
 
-	master->data = pdata;
+	master->data = ddata;
 	master->read_bit = w1_gpio_read_bit;
-	gpiod_direction_output(pdata->gpiod, 1);
+	gpiod_direction_output(ddata->gpiod, 1);
 	master->write_bit = w1_gpio_write_bit;
 
 	/*
@@ -133,8 +133,8 @@  static int w1_gpio_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	if (pdata->pullup_gpiod)
-		gpiod_set_value(pdata->pullup_gpiod, 1);
+	if (ddata->pullup_gpiod)
+		gpiod_set_value(ddata->pullup_gpiod, 1);
 
 	platform_set_drvdata(pdev, master);
 
@@ -144,10 +144,10 @@  static int w1_gpio_probe(struct platform_device *pdev)
 static int w1_gpio_remove(struct platform_device *pdev)
 {
 	struct w1_bus_master *master = platform_get_drvdata(pdev);
-	struct w1_gpio_ddata *pdata = master->data;
+	struct w1_gpio_ddata *ddata = master->data;
 
-	if (pdata->pullup_gpiod)
-		gpiod_set_value(pdata->pullup_gpiod, 0);
+	if (ddata->pullup_gpiod)
+		gpiod_set_value(ddata->pullup_gpiod, 0);
 
 	w1_remove_master_device(master);