Linux PWM subsystem development
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Yauhen Kharuzhy <jekhor@gmail.com>,
	platform-driver-x86@vger.kernel.org, linux-pwm@vger.kernel.org
Subject: [PATCH 08/19] platform/x86: lenovo-yogabook: Add dev local variable to probe()
Date: Sat, 29 Apr 2023 20:15:40 +0200	[thread overview]
Message-ID: <20230429181551.98201-9-hdegoede@redhat.com> (raw)
In-Reply-To: <20230429181551.98201-1-hdegoede@redhat.com>

Add a "struct device *dev" local variable to probe().

This is a preparation patch for making lenovo-yogabook-wmi also work
on the Android version of the Yoga Book 1 which does not have a WMI
interface to deal with toggling the keyboard half between
touch-keyboard and wacom-digitizer mode.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/lenovo-yogabook-wmi.c | 23 +++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/platform/x86/lenovo-yogabook-wmi.c b/drivers/platform/x86/lenovo-yogabook-wmi.c
index 2bf40930c51a..b1d17ce9a46c 100644
--- a/drivers/platform/x86/lenovo-yogabook-wmi.c
+++ b/drivers/platform/x86/lenovo-yogabook-wmi.c
@@ -227,16 +227,17 @@ static struct gpiod_lookup_table yogabook_wmi_gpios = {
 
 static int yogabook_wmi_probe(struct wmi_device *wdev, const void *context)
 {
+	struct device *dev = &wdev->dev;
 	struct yogabook_wmi *data;
 	int r;
 
-	data = devm_kzalloc(&wdev->dev, sizeof(struct yogabook_wmi), GFP_KERNEL);
+	data = devm_kzalloc(dev, sizeof(struct yogabook_wmi), GFP_KERNEL);
 	if (data == NULL)
 		return -ENOMEM;
 
-	dev_set_drvdata(&wdev->dev, data);
+	dev_set_drvdata(dev, data);
 
-	data->dev = &wdev->dev;
+	data->dev = dev;
 	data->brightness = YB_KBD_BL_DEFAULT;
 	set_bit(YB_KBD_IS_ON, &data->flags);
 	set_bit(YB_DIGITIZER_IS_ON, &data->flags);
@@ -244,13 +245,13 @@ static int yogabook_wmi_probe(struct wmi_device *wdev, const void *context)
 
 	data->kbd_adev = acpi_dev_get_first_match_dev("GDIX1001", NULL, -1);
 	if (!data->kbd_adev) {
-		dev_err(&wdev->dev, "Cannot find the touchpad device in ACPI tables\n");
+		dev_err(dev, "Cannot find the touchpad device in ACPI tables\n");
 		return -ENODEV;
 	}
 
 	data->dig_adev = acpi_dev_get_first_match_dev("WCOM0019", NULL, -1);
 	if (!data->dig_adev) {
-		dev_err(&wdev->dev, "Cannot find the digitizer device in ACPI tables\n");
+		dev_err(dev, "Cannot find the digitizer device in ACPI tables\n");
 		r = -ENODEV;
 		goto error_put_devs;
 	}
@@ -268,18 +269,18 @@ static int yogabook_wmi_probe(struct wmi_device *wdev, const void *context)
 	}
 
 	gpiod_add_lookup_table(&yogabook_wmi_gpios);
-	data->backside_hall_gpio = devm_gpiod_get(&wdev->dev, "backside_hall_sw", GPIOD_IN);
+	data->backside_hall_gpio = devm_gpiod_get(dev, "backside_hall_sw", GPIOD_IN);
 	gpiod_remove_lookup_table(&yogabook_wmi_gpios);
 
 	if (IS_ERR(data->backside_hall_gpio)) {
 		r = PTR_ERR(data->backside_hall_gpio);
-		dev_err_probe(&wdev->dev, r, "Getting backside_hall_sw GPIO\n");
+		dev_err_probe(dev, r, "Getting backside_hall_sw GPIO\n");
 		goto error_put_devs;
 	}
 
 	r = gpiod_to_irq(data->backside_hall_gpio);
 	if (r < 0) {
-		dev_err_probe(&wdev->dev, r, "Getting backside_hall_sw IRQ\n");
+		dev_err_probe(dev, r, "Getting backside_hall_sw IRQ\n");
 		goto error_put_devs;
 	}
 	data->backside_hall_irq = r;
@@ -291,7 +292,7 @@ static int yogabook_wmi_probe(struct wmi_device *wdev, const void *context)
 			IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
 			"backside_hall_sw", data);
 	if (r) {
-		dev_err_probe(&wdev->dev, r, "Requesting backside_hall_sw IRQ\n");
+		dev_err_probe(dev, r, "Requesting backside_hall_sw IRQ\n");
 		goto error_put_devs;
 	}
 
@@ -302,9 +303,9 @@ static int yogabook_wmi_probe(struct wmi_device *wdev, const void *context)
 	data->kbd_bl_led.brightness_get = kbd_brightness_get;
 	data->kbd_bl_led.max_brightness = 255;
 
-	r = devm_led_classdev_register(&wdev->dev, &data->kbd_bl_led);
+	r = devm_led_classdev_register(dev, &data->kbd_bl_led);
 	if (r < 0) {
-		dev_err_probe(&wdev->dev, r, "Registering backlight LED device\n");
+		dev_err_probe(dev, r, "Registering backlight LED device\n");
 		goto error_free_irq;
 	}
 
-- 
2.39.2


  parent reply	other threads:[~2023-04-29 18:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-29 18:15 [PATCH 00/19] platform/x86: lenovo-yogabook: Modify to also work on Android version Hans de Goede
2023-04-29 18:15 ` [PATCH 01/19] pwm: Export pwm_add_table() / pwm_remove_table() Hans de Goede
2023-04-29 18:15 ` [PATCH 02/19] platform/x86: lenovo-yogabook: Fix work race on remove() Hans de Goede
2023-04-29 18:15 ` [PATCH 03/19] platform/x86: lenovo-yogabook: Reprobe devices " Hans de Goede
2023-04-29 18:15 ` [PATCH 04/19] platform/x86: lenovo-yogabook: Set default keyboard backligh brightness on probe() Hans de Goede
2023-04-29 18:15 ` [PATCH 05/19] platform/x86: lenovo-yogabook: Simplify gpio lookup table cleanup Hans de Goede
2023-04-29 18:15 ` [PATCH 06/19] platform/x86: lenovo-yogabook: Switch to DEFINE_SIMPLE_DEV_PM_OPS() Hans de Goede
2023-04-29 18:15 ` [PATCH 07/19] platform/x86: lenovo-yogabook: Store dev instead of wdev in drvdata struct Hans de Goede
2023-04-29 18:15 ` Hans de Goede [this message]
2023-04-30 10:31   ` [PATCH 08/19] platform/x86: lenovo-yogabook: Add dev local variable to probe() Andy Shevchenko
2023-04-29 18:15 ` [PATCH 09/19] platform/x86: lenovo-yogabook: Use PMIC LED driver for pen icon LED control Hans de Goede
2023-04-30 10:35   ` Andy Shevchenko
2023-04-29 18:15 ` [PATCH 10/19] platform/x86: lenovo-yogabook: Split probe() into generic and WMI specific parts Hans de Goede
2023-04-30 10:38   ` Andy Shevchenko
2023-04-29 18:15 ` [PATCH 11/19] platform/x86: lenovo-yogabook: Stop checking adev->power.state Hans de Goede
2023-04-29 18:15 ` [PATCH 12/19] platform/x86: lenovo-yogabook: Abstract kbd backlight setting Hans de Goede
2023-04-30 10:41   ` Andy Shevchenko
2023-04-29 18:15 ` [PATCH 13/19] platform/x86: lenovo-yogabook: Add a yogabook_toggle_digitizer_mode() helper function Hans de Goede
2023-04-29 18:15 ` [PATCH 14/19] platform/x86: lenovo-yogabook: Drop _wmi_ from remaining generic symbols Hans de Goede
2023-04-30 10:44   ` Andy Shevchenko
2023-04-29 18:15 ` [PATCH 15/19] platform/x86: lenovo-yogabook: Group WMI specific code together Hans de Goede
2023-04-29 18:15 ` [PATCH 16/19] platform/x86: lenovo-yogabook: Add YB_KBD_BL_MAX define Hans de Goede
2023-04-29 18:15 ` [PATCH 17/19] platform/x86: lenovo-yogabook: Add platform driver support Hans de Goede
2023-04-30 10:49   ` Andy Shevchenko
2023-04-30 15:39     ` Hans de Goede
2023-04-29 18:15 ` [PATCH 18/19] platform/x86: lenovo-yogabook: Add keyboard backlight control to platform driver Hans de Goede
2023-04-30 10:51   ` Andy Shevchenko
2023-04-29 18:15 ` [PATCH 19/19] platform/x86: lenovo-yogabook: Rename lenovo-yogabook-wmi to lenovo-yogabook Hans de Goede
2023-05-03 18:16 ` [PATCH 00/19] platform/x86: lenovo-yogabook: Modify to also work on Android version Yauhen Kharuzhy

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=20230429181551.98201-9-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andy@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jekhor@gmail.com \
    --cc=linux-pwm@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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