Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp314931pxf; Wed, 24 Mar 2021 05:58:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4hBUqF0RPK4+ldvpkXzHVD1m01/EoMN0sNyyhyIgh4Y80PeBb2FsAxVVTLYG7nWR9f4kB X-Received: by 2002:a17:906:b747:: with SMTP id fx7mr3615622ejb.474.1616590717757; Wed, 24 Mar 2021 05:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616590717; cv=none; d=google.com; s=arc-20160816; b=GKfD+lketvlDI9A8l4JGlvMMZQdcQgRnVLmBFyZRoupmFz7+/CaaR34O901HdZ0Ltd 3c9WhdaL7tc89+i+3jEi1aCdvkQTv3U2i4zbfKPPn3uIYQ79agk6RNBtceoaeaQ61XEc URCpkSIzPdikOyLSfYUfUHTp8yEdCXjPKAeTdXA4PZzSD8ySz2j68+r2KIbgJIJ1Ux9e XhouQnSf/Ud6yVVmOWT/4U06837Ad6PYUC62KqEZzvZQXfJq0yWYHp2u4MQkKT2CXX7k 15YJ+3IbRBDhgsBffxtNcw5s8XMceocM+bXaLoJR9FLMCHkSjTEo6+mZUpOen/THMJgC Nb1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gTwIvnFJ6UsqMLEIUtmaMXWTcL1Cr8qDnDvFwxUlyRo=; b=HT7idMIgBzluJQF/hcyiEoBSnWWEeEK+F92mufsOr2YnGHxG+dXvQ2xrKwQEEeJ2/x CB6bdmrUoizsGDmSpXigPuzNAmx7Jak0oAGHQIEZxV/mZkLX0l/9Skpw5DHvdaFgFXXT fr39LKmNY+dJ+W2j3jI/IV1H0nKLxg+CcTVab7EBKwfJrQ7n8R209+Gv3lN7x9weJz4l hHoWUf3hAhfSqz3t5UI52RLS5BEnFF4xdXMuBczBfQy3NCE9sBX9celecfVaQHTNk+X0 AtqgZUIEsyc3g3MDItWIGFxt7DtLwR2oCnjO7lPOUNoMOI82fP62Hixcl7ZPa5o2qoWH b+TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b="bmsC/KwY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si1810083eju.371.2021.03.24.05.58.14; Wed, 24 Mar 2021 05:58:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b="bmsC/KwY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235110AbhCXM4u (ORCPT + 99 others); Wed, 24 Mar 2021 08:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234568AbhCXM4G (ORCPT ); Wed, 24 Mar 2021 08:56:06 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EE8FC0613E0 for ; Wed, 24 Mar 2021 05:56:06 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id bx7so27488607edb.12 for ; Wed, 24 Mar 2021 05:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=deviqon.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gTwIvnFJ6UsqMLEIUtmaMXWTcL1Cr8qDnDvFwxUlyRo=; b=bmsC/KwYkIzuvFP7Idgwv5+p6kgC9Ye8LKkbjNEhX+tq2iw90b48JioM/uXs8qGp/j 7yfjdIrCmrv2sB6OFf7M/FkpXYW7wjcT250s9W0gpygqFAd/vs/vdAD5FiiMWDwwNaTp OJgN+VCaAK4AniCbsqmqMkoi02XTfkzi4z/5KDgEaiJotbunvsNjL6+KH7x2+mBaXm3k Vt5Rq5QBnW9eCfp/6ToIbwu4YojnHMXcjCHciJl5BWnrEhHfyXAJD+pfJu6vho1VyuF+ z07Xlox0xuiuC7pl3CAuzlGy+jeFgHtaYJACRudvls1IjhT5jCVEOqQRpigkXONRBI3Q rSIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gTwIvnFJ6UsqMLEIUtmaMXWTcL1Cr8qDnDvFwxUlyRo=; b=dlL+RvL7zkrTtpk47VRrf8wTmQpExhB0XPhBV4OsX/jMi/hnvM98Lx1tah0rL/b+Yt ZuuBmMYPmRHLq8BXX3wjgQOl6NMwIUekB492CfGJd0EhTokzSwNKwrpXNdmYq1DS8vn0 ztiKY+huWs2CNHEtepiuxL81cqmC1jtrfKPZhfmDtlyYq5sSJM5d5GMYXgGiETnEqjCj TSrwYPiixftrjKRia5E2KOH6FOGwQytIAH21HvN4QZpsOil8dbsbg9CcH7pHRsEpgNnu /S+DSDRRlYru1Dn5KADI1KvSP5o1KWMgChxB6wBUg7Kg96loTTQa5VgDxeU6e8Kv/y0h bzPw== X-Gm-Message-State: AOAM531KobhEVUCfnMGOW3hFRvRyMorbJd3Nnphw2VOEpDkL9xmISb3m FGDIfhrTaqzSw//6dyCA62Hh1w== X-Received: by 2002:a05:6402:51cd:: with SMTP id r13mr3347222edd.116.1616590565316; Wed, 24 Mar 2021 05:56:05 -0700 (PDT) Received: from localhost.localdomain ([5.2.193.191]) by smtp.gmail.com with ESMTPSA id fi11sm880282ejb.73.2021.03.24.05.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 05:56:05 -0700 (PDT) From: Alexandru Ardelean To: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Cc: coproscefalo@gmail.com, hdegoede@redhat.com, mgross@linux.intel.com, jic23@kernel.org, linux@deviqon.com, Alexandru Ardelean Subject: [PATCH 05/10] platform/x86: toshiba_acpi: register backlight with device-managed variant Date: Wed, 24 Mar 2021 14:55:43 +0200 Message-Id: <20210324125548.45983-6-aardelean@deviqon.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324125548.45983-1-aardelean@deviqon.com> References: <20210324125548.45983-1-aardelean@deviqon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This change converts the registration of the backlight data with the devm_backlight_device_register() function. This way, the backlight_device_unregister() call is no longer required, and the order of deregistration is made to be more symmetrical with the registration order. Signed-off-by: Alexandru Ardelean --- drivers/platform/x86/toshiba_acpi.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 556f2cc99bad..ada2a2d8c913 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c @@ -2876,7 +2876,8 @@ static int toshiba_acpi_setup_keyboard(struct device *parent, return error; } -static int toshiba_acpi_setup_backlight(struct toshiba_acpi_dev *dev) +static int toshiba_acpi_setup_backlight(struct device *parent, + struct toshiba_acpi_dev *dev) { struct backlight_properties props; int brightness; @@ -2924,11 +2925,12 @@ static int toshiba_acpi_setup_backlight(struct toshiba_acpi_dev *dev) if (dev->tr_backlight_supported) props.max_brightness++; - dev->backlight_dev = backlight_device_register("toshiba", - &dev->acpi_dev->dev, - dev, - &toshiba_backlight_data, - &props); + dev->backlight_dev = devm_backlight_device_register(parent, + "toshiba", + &dev->acpi_dev->dev, + dev, + &toshiba_backlight_data, + &props); if (IS_ERR(dev->backlight_dev)) { ret = PTR_ERR(dev->backlight_dev); pr_err("Could not register toshiba backlight device\n"); @@ -2999,8 +3001,6 @@ static int toshiba_acpi_remove(struct acpi_device *acpi_dev) sysfs_remove_group(&dev->acpi_dev->dev.kobj, &toshiba_attr_group); - backlight_device_unregister(dev->backlight_dev); - led_classdev_unregister(&dev->led_dev); led_classdev_unregister(&dev->kbd_led); led_classdev_unregister(&dev->eco_led); @@ -3104,9 +3104,9 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev) ret = get_tr_backlight_status(dev, &dummy); dev->tr_backlight_supported = !ret; - ret = toshiba_acpi_setup_backlight(dev); + ret = toshiba_acpi_setup_backlight(parent, dev); if (ret) - goto error; + return ret; toshiba_illumination_available(dev); if (dev->illumination_supported) { -- 2.30.2