From 9d9cb51ef71c0963bd59ef1ec9eaab6b7c070efe Mon Sep 17 00:00:00 2001 From: Ksawlii Date: Sun, 24 Nov 2024 00:23:17 +0100 Subject: [PATCH] Revert "USB: appledisplay: close race between probe and completion handler" This reverts commit 4445d6f605d8eae5a47fa918c0b0abeca507d6ff. --- drivers/usb/misc/appledisplay.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c index 62b5a30ed..c8098e9b4 100755 --- a/drivers/usb/misc/appledisplay.c +++ b/drivers/usb/misc/appledisplay.c @@ -107,12 +107,7 @@ static void appledisplay_complete(struct urb *urb) case ACD_BTN_BRIGHT_UP: case ACD_BTN_BRIGHT_DOWN: pdata->button_pressed = 1; - /* - * there is a window during which no device - * is registered - */ - if (pdata->bd ) - schedule_delayed_work(&pdata->work, 0); + schedule_delayed_work(&pdata->work, 0); break; case ACD_BTN_NONE: default: @@ -207,7 +202,6 @@ static int appledisplay_probe(struct usb_interface *iface, const struct usb_device_id *id) { struct backlight_properties props; - struct backlight_device *backlight; struct appledisplay *pdata; struct usb_device *udev = interface_to_usbdev(iface); struct usb_endpoint_descriptor *endpoint; @@ -278,14 +272,13 @@ static int appledisplay_probe(struct usb_interface *iface, memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; props.max_brightness = 0xff; - backlight = backlight_device_register(bl_name, NULL, pdata, + pdata->bd = backlight_device_register(bl_name, NULL, pdata, &appledisplay_bl_data, &props); - if (IS_ERR(backlight)) { + if (IS_ERR(pdata->bd)) { dev_err(&iface->dev, "Backlight registration failed\n"); - retval = PTR_ERR(backlight); + retval = PTR_ERR(pdata->bd); goto error; } - pdata->bd = backlight; /* Try to get brightness */ brightness = appledisplay_bl_get_brightness(pdata->bd);