From: Dmitry Torokhov <dmitry.torokhov@gmail.com> To: Daniel Thompson <daniel.thompson@linaro.org>, Lee Jones <lee@kernel.org>, Jingoo Han <jingoohan1@gmail.com> Cc: Helge Deller <deller@gmx.de>, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] backlight: hx8357: stop using of-specific APIs Date: Tue, 31 Jan 2023 14:57:07 -0800 [thread overview] Message-ID: <20230131225707.3599889-2-dmitry.torokhov@gmail.com> (raw) In-Reply-To: <20230131225707.3599889-1-dmitry.torokhov@gmail.com> There is no need for this driver to be OF-specific, so switch it to use device_get_match_data() and stop including various of-related headers. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> --- drivers/video/backlight/hx8357.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/video/backlight/hx8357.c b/drivers/video/backlight/hx8357.c index a93e14adb846..2e162a70c1ce 100644 --- a/drivers/video/backlight/hx8357.c +++ b/drivers/video/backlight/hx8357.c @@ -10,8 +10,8 @@ #include <linux/gpio/consumer.h> #include <linux/lcd.h> #include <linux/module.h> -#include <linux/of.h> -#include <linux/of_device.h> +#include <linux/mod_devicetable.h> +#include <linux/property.h> #include <linux/spi/spi.h> #define HX8357_NUM_IM_PINS 3 @@ -581,11 +581,15 @@ MODULE_DEVICE_TABLE(of, hx8357_dt_ids); static int hx8357_probe(struct spi_device *spi) { + int (*lcd_init_fn)(struct lcd_device *); struct lcd_device *lcdev; struct hx8357_data *lcd; - const struct of_device_id *match; int i, ret; + lcd_init_fn = device_get_match_data(&spi->dev); + if (!lcd_init_fn) + return -EINVAL; + lcd = devm_kzalloc(&spi->dev, sizeof(*lcd), GFP_KERNEL); if (!lcd) return -ENOMEM; @@ -598,10 +602,6 @@ static int hx8357_probe(struct spi_device *spi) lcd->spi = spi; - match = of_match_device(hx8357_dt_ids, &spi->dev); - if (!match || !match->data) - return -EINVAL; - lcd->reset = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW); ret = PTR_ERR_OR_ZERO(lcd->reset); if (ret) { @@ -647,7 +647,7 @@ static int hx8357_probe(struct spi_device *spi) hx8357_lcd_reset(lcdev); - ret = ((int (*)(struct lcd_device *))match->data)(lcdev); + ret = lcd_init_fn(lcdev); if (ret) { dev_err(&spi->dev, "Couldn't initialize panel\n"); return ret; -- 2.39.1.456.gfc5497dd1b-goog
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dmitry.torokhov@gmail.com> To: Daniel Thompson <daniel.thompson@linaro.org>, Lee Jones <lee@kernel.org>, Jingoo Han <jingoohan1@gmail.com> Cc: Helge Deller <deller@gmx.de>, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] backlight: hx8357: stop using of-specific APIs Date: Tue, 31 Jan 2023 14:57:07 -0800 [thread overview] Message-ID: <20230131225707.3599889-2-dmitry.torokhov@gmail.com> (raw) In-Reply-To: <20230131225707.3599889-1-dmitry.torokhov@gmail.com> There is no need for this driver to be OF-specific, so switch it to use device_get_match_data() and stop including various of-related headers. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> --- drivers/video/backlight/hx8357.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/video/backlight/hx8357.c b/drivers/video/backlight/hx8357.c index a93e14adb846..2e162a70c1ce 100644 --- a/drivers/video/backlight/hx8357.c +++ b/drivers/video/backlight/hx8357.c @@ -10,8 +10,8 @@ #include <linux/gpio/consumer.h> #include <linux/lcd.h> #include <linux/module.h> -#include <linux/of.h> -#include <linux/of_device.h> +#include <linux/mod_devicetable.h> +#include <linux/property.h> #include <linux/spi/spi.h> #define HX8357_NUM_IM_PINS 3 @@ -581,11 +581,15 @@ MODULE_DEVICE_TABLE(of, hx8357_dt_ids); static int hx8357_probe(struct spi_device *spi) { + int (*lcd_init_fn)(struct lcd_device *); struct lcd_device *lcdev; struct hx8357_data *lcd; - const struct of_device_id *match; int i, ret; + lcd_init_fn = device_get_match_data(&spi->dev); + if (!lcd_init_fn) + return -EINVAL; + lcd = devm_kzalloc(&spi->dev, sizeof(*lcd), GFP_KERNEL); if (!lcd) return -ENOMEM; @@ -598,10 +602,6 @@ static int hx8357_probe(struct spi_device *spi) lcd->spi = spi; - match = of_match_device(hx8357_dt_ids, &spi->dev); - if (!match || !match->data) - return -EINVAL; - lcd->reset = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW); ret = PTR_ERR_OR_ZERO(lcd->reset); if (ret) { @@ -647,7 +647,7 @@ static int hx8357_probe(struct spi_device *spi) hx8357_lcd_reset(lcdev); - ret = ((int (*)(struct lcd_device *))match->data)(lcdev); + ret = lcd_init_fn(lcdev); if (ret) { dev_err(&spi->dev, "Couldn't initialize panel\n"); return ret; -- 2.39.1.456.gfc5497dd1b-goog
next prev parent reply other threads:[~2023-01-31 22:57 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-31 22:57 [PATCH 1/2] backlight: hx8357: switch to using gpiod API Dmitry Torokhov 2023-01-31 22:57 ` Dmitry Torokhov 2023-01-31 22:57 ` Dmitry Torokhov [this message] 2023-01-31 22:57 ` [PATCH 2/2] backlight: hx8357: stop using of-specific APIs Dmitry Torokhov 2023-02-06 11:42 ` Daniel Thompson 2023-02-06 11:42 ` Daniel Thompson 2023-02-06 11:35 ` [PATCH 1/2] backlight: hx8357: switch to using gpiod API Daniel Thompson 2023-02-06 11:35 ` Daniel Thompson 2023-02-07 4:15 ` Dmitry Torokhov 2023-02-07 4:15 ` Dmitry Torokhov 2023-02-07 16:04 ` Daniel Thompson 2023-02-07 16:04 ` Daniel Thompson
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=20230131225707.3599889-2-dmitry.torokhov@gmail.com \ --to=dmitry.torokhov@gmail.com \ --cc=daniel.thompson@linaro.org \ --cc=deller@gmx.de \ --cc=dri-devel@lists.freedesktop.org \ --cc=jingoohan1@gmail.com \ --cc=lee@kernel.org \ --cc=linux-fbdev@vger.kernel.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.