public inbox for linux-kernel@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-kernel@vger.kernel.org
Cc: Lee Jones <lee@kernel.org>, Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH v1 1/2] mfd: lm3533: Hide legacy platform data in the driver
Date: Wed,  8 May 2024 13:46:48 +0300	[thread overview]
Message-ID: <20240508104848.846580-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20240508104848.846580-1-andriy.shevchenko@linux.intel.com>

First of all, there is no user for the platform data in the kernel.
Second, it needs a lot of updates to follow the modern standards
of the kernel, including proper Device Tree bindings and device
property handling.

For now, just hide the legacy platform data in the driver's code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mfd/lm3533-core.c  | 23 ++++++++++++++++++-----
 include/linux/mfd/lm3533.h | 15 ---------------
 2 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
index c211183cecb2..515a6c3b3244 100644
--- a/drivers/mfd/lm3533-core.c
+++ b/drivers/mfd/lm3533-core.c
@@ -21,6 +21,20 @@
 
 #include <linux/mfd/lm3533.h>
 
+struct lm3533_platform_data {
+	int gpio_hwen;
+
+	enum lm3533_boost_ovp boost_ovp;
+	enum lm3533_boost_freq boost_freq;
+
+	struct lm3533_als_platform_data *als;
+
+	struct lm3533_bl_platform_data *backlights;
+	int num_backlights;
+
+	struct lm3533_led_platform_data *leds;
+	int num_leds;
+};
 
 #define LM3533_BOOST_OVP_MASK		0x06
 #define LM3533_BOOST_OVP_SHIFT		1
@@ -473,15 +487,14 @@ static int lm3533_device_setup(struct lm3533 *lm3533,
 
 static int lm3533_device_init(struct lm3533 *lm3533)
 {
-	struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev);
+	struct lm3533_platform_data *pdata;
 	int ret;
 
 	dev_dbg(lm3533->dev, "%s\n", __func__);
 
-	if (!pdata) {
-		dev_err(lm3533->dev, "no platform data\n");
-		return -EINVAL;
-	}
+	pdata = devm_kzalloc(lm3533->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
 
 	lm3533->gpio_hwen = pdata->gpio_hwen;
 
diff --git a/include/linux/mfd/lm3533.h b/include/linux/mfd/lm3533.h
index 77092f6363ad..ce42f0737768 100644
--- a/include/linux/mfd/lm3533.h
+++ b/include/linux/mfd/lm3533.h
@@ -68,21 +68,6 @@ enum lm3533_boost_ovp {
 	LM3533_BOOST_OVP_40V,
 };
 
-struct lm3533_platform_data {
-	int gpio_hwen;
-
-	enum lm3533_boost_ovp boost_ovp;
-	enum lm3533_boost_freq boost_freq;
-
-	struct lm3533_als_platform_data *als;
-
-	struct lm3533_bl_platform_data *backlights;
-	int num_backlights;
-
-	struct lm3533_led_platform_data *leds;
-	int num_leds;
-};
-
 extern int lm3533_ctrlbank_enable(struct lm3533_ctrlbank *cb);
 extern int lm3533_ctrlbank_disable(struct lm3533_ctrlbank *cb);
 
-- 
2.43.0.rc1.1336.g36b5255a03ac


  reply	other threads:[~2024-05-08 10:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 10:46 [PATCH v1 0/2] mfd: lm3533: Get rid of legacy GPIO APIs Andy Shevchenko
2024-05-08 10:46 ` Andy Shevchenko [this message]
2024-05-27 13:03   ` [PATCH v1 1/2] mfd: lm3533: Hide legacy platform data in the driver Linus Walleij
2024-05-31 15:00   ` Lee Jones
2024-05-31 15:08     ` Andy Shevchenko
2024-05-31 15:54       ` Lee Jones
2024-05-31 16:40         ` Andy Shevchenko
2024-05-31 16:58           ` Lee Jones
2024-05-31 17:09             ` Andy Shevchenko
2024-06-05 12:40             ` Johan Hovold
2024-05-08 10:46 ` [PATCH v1 2/2] mfd: lm3533: Move to new GPIO descriptor-based APIs Andy Shevchenko
2024-05-27 13:05   ` 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=20240508104848.846580-2-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=lee@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    /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