Skip to content

Commit b69e478

Browse files
committed
Merge tag 'backlight-next-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones: "Apple Backlight: - Convert the Apple Backlight ACPI driver to a proper platform driver, aligning with current ACPI binding practices Skyworks SKY81452: - Check the return value of `devm_gpiod_get_optional()` to properly handle GPIO acquisition errors" * tag 'backlight-next-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: backlight: apple_bl: Convert to a platform driver backlight: sky81452-backlight: Check return value of devm_gpiod_get_optional() in sky81452_bl_parse_dt()
2 parents d884efd + 04d8f3f commit b69e478

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

drivers/video/backlight/apple_bl.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/pci.h>
2525
#include <linux/acpi.h>
2626
#include <linux/atomic.h>
27+
#include <linux/platform_device.h>
2728
#include <acpi/video.h>
2829

2930
static struct backlight_device *apple_backlight_device;
@@ -134,7 +135,7 @@ static const struct hw_data nvidia_chipset_data = {
134135
.set_brightness = nvidia_chipset_set_brightness,
135136
};
136137

137-
static int apple_bl_add(struct acpi_device *dev)
138+
static int apple_bl_probe(struct platform_device *pdev)
138139
{
139140
struct backlight_properties props;
140141
struct pci_dev *host;
@@ -193,7 +194,7 @@ static int apple_bl_add(struct acpi_device *dev)
193194
return 0;
194195
}
195196

196-
static void apple_bl_remove(struct acpi_device *dev)
197+
static void apple_bl_remove(struct platform_device *pdev)
197198
{
198199
backlight_device_unregister(apple_backlight_device);
199200

@@ -206,12 +207,12 @@ static const struct acpi_device_id apple_bl_ids[] = {
206207
{"", 0},
207208
};
208209

209-
static struct acpi_driver apple_bl_driver = {
210-
.name = "Apple backlight",
211-
.ids = apple_bl_ids,
212-
.ops = {
213-
.add = apple_bl_add,
214-
.remove = apple_bl_remove,
210+
static struct platform_driver apple_bl_driver = {
211+
.probe = apple_bl_probe,
212+
.remove = apple_bl_remove,
213+
.driver = {
214+
.name = "Apple backlight",
215+
.acpi_match_table = apple_bl_ids,
215216
},
216217
};
217218

@@ -224,12 +225,12 @@ static int __init apple_bl_init(void)
224225
if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
225226
return -ENODEV;
226227

227-
return acpi_bus_register_driver(&apple_bl_driver);
228+
return platform_driver_register(&apple_bl_driver);
228229
}
229230

230231
static void __exit apple_bl_exit(void)
231232
{
232-
acpi_bus_unregister_driver(&apple_bl_driver);
233+
platform_driver_unregister(&apple_bl_driver);
233234
}
234235

235236
module_init(apple_bl_init);

drivers/video/backlight/sky81452-backlight.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
202202
pdata->dpwm_mode = of_property_read_bool(np, "skyworks,dpwm-mode");
203203
pdata->phase_shift = of_property_read_bool(np, "skyworks,phase-shift");
204204
pdata->gpiod_enable = devm_gpiod_get_optional(dev, NULL, GPIOD_OUT_HIGH);
205+
if (IS_ERR(pdata->gpiod_enable))
206+
return dev_err_cast_probe(dev, pdata->gpiod_enable,
207+
"failed to get gpio\n");
205208

206209
ret = of_property_count_u32_elems(np, "led-sources");
207210
if (ret < 0) {

0 commit comments

Comments
 (0)