public inbox for linux-gpio@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Patrick Rudolph <patrick.rudolph@9elements.com>,
	Linus Walleij <linusw@kernel.org>
Subject: [PATCH v1 5/8] pinctrl: cy8c95x0: Move driver data to the local variable in ->probe()
Date: Mon, 23 Feb 2026 19:06:55 +0100	[thread overview]
Message-ID: <20260223180859.2845261-6-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20260223180859.2845261-1-andriy.shevchenko@linux.intel.com>

For all these years of driver existence the driver_data has been used
only as a raw material for other fields in the struct cy8c95x0_pinctrl.
Move it from the structure to be just a local variable in ->probe().
Later, if ever need arises, we may reconsider that.

While at it, drop an unneeded validation and replace uintptr_t with plain
unsigned long which is more readable and works in the same way.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/pinctrl-cy8c95x0.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-cy8c95x0.c b/drivers/pinctrl/pinctrl-cy8c95x0.c
index 94a599486638..4f804a9358b7 100644
--- a/drivers/pinctrl/pinctrl-cy8c95x0.c
+++ b/drivers/pinctrl/pinctrl-cy8c95x0.c
@@ -144,7 +144,6 @@ static const struct dmi_system_id cy8c95x0_dmi_acpi_irq_info[] = {
  * @map:            Mask used to compensate for Gport2 width
  * @nport:          Number of Gports in this chip
  * @gpio_chip:      gpiolib chip
- * @driver_data:    private driver data
  * @dev:            struct device
  * @pctldev:        pin controller device
  * @pinctrl_desc:   pin controller description
@@ -165,7 +164,6 @@ struct cy8c95x0_pinctrl {
 	DECLARE_BITMAP(map, MAX_LINE);
 	unsigned int nport;
 	struct gpio_chip gpio_chip;
-	unsigned long driver_data;
 	struct device *dev;
 	struct pinctrl_dev *pctldev;
 	struct pinctrl_desc pinctrl_desc;
@@ -1397,6 +1395,7 @@ static int cy8c95x0_probe(struct i2c_client *client)
 	struct cy8c95x0_pinctrl *chip;
 	struct regmap_config regmap_conf;
 	struct regmap_range_cfg regmap_range_conf;
+	unsigned long driver_data;
 	int ret;
 
 	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
@@ -1406,11 +1405,9 @@ static int cy8c95x0_probe(struct i2c_client *client)
 	chip->dev = dev;
 
 	/* Set the device type */
-	chip->driver_data = (uintptr_t)i2c_get_match_data(client);
-	if (!chip->driver_data)
-		return -ENODEV;
+	driver_data = (unsigned long)i2c_get_match_data(client);
 
-	chip->tpin = chip->driver_data & CY8C95X0_GPIO_MASK;
+	chip->tpin = driver_data & CY8C95X0_GPIO_MASK;
 	chip->nport = DIV_ROUND_UP(CY8C95X0_PIN_TO_OFFSET(chip->tpin), BANK_SZ);
 
 	memcpy(&regmap_range_conf, &cy8c95x0_ranges[0], sizeof(regmap_range_conf));
-- 
2.50.1


  parent reply	other threads:[~2026-02-23 18:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 18:06 [PATCH v1 0/8] pinctrl: cy8c95x0: Yet another cleanup series and a fix Andy Shevchenko
2026-02-23 18:06 ` [PATCH v1 1/8] pinctrl: cy8c95x0: Don't miss reading the last bank registers Andy Shevchenko
2026-02-23 18:06 ` [PATCH v1 2/8] pinctrl: cy8c95x0: Use devm_mutex_init() for mutex initialization Andy Shevchenko
2026-02-23 18:06 ` [PATCH v1 3/8] pinctrl: cy8c95x0: remove duplicate error message Andy Shevchenko
2026-02-23 18:06 ` [PATCH v1 4/8] pinctrl: cy8c95x0: Unify messages with help of dev_err_probe() Andy Shevchenko
2026-02-23 18:06 ` Andy Shevchenko [this message]
2026-02-23 18:06 ` [PATCH v1 6/8] pinctrl: cy8c95x0: Drop unused 'name' in struct cy8c95x0_pinctrl Andy Shevchenko
2026-02-23 18:06 ` [PATCH v1 7/8] pinctrl: cy8c95x0: Eliminate fragile use of I²C ID table Andy Shevchenko
2026-02-23 18:06 ` [PATCH v1 8/8] pinctrl: cy8c95x0: Gather ID tables in one place Andy Shevchenko
2026-02-26 22:43 ` [PATCH v1 0/8] pinctrl: cy8c95x0: Yet another cleanup series and a fix Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260223180859.2845261-6-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrick.rudolph@9elements.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox