Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7295396ybi; Mon, 22 Jul 2019 10:29:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9hhItT+odenwh6maxsEvPnHnkqU4+Zbrrs1qzo19j7/74AaB8gNBLAHdSpOXN2PwI/roq X-Received: by 2002:a62:b615:: with SMTP id j21mr1296166pff.190.1563816556756; Mon, 22 Jul 2019 10:29:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563816556; cv=none; d=google.com; s=arc-20160816; b=U1/8YuREACSs1ZdoxCCmpnS/CocFuIq8GUmsM5HlgV15/8/DohUpHsuuJYp0XTOkSR 1fauK1eNI5mtBejWVREzldz2w4bvTpcYFWlRMIwYme/NWAAa8glXsfJWGzR5KuxojjKW 1k5HXvfEq6H2nxVlZsdB6XgljybRP8vVbUS/mLuSPQoRSEtP78g9Opk7ZfmSFiT+c9ia nF9xxJfB4oemD+Djd+dtyjkzWDlOibaRsPW4Y7oICsJe+iOYSzAouHZuE9P0VytS60qK kE+mFrHQKdDY9hpz1ZRlSmag3y0v4mhuw1wvRw7kWIHEZgIrqQUltMZi3zrMG6Gb8xdz WUsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iAL0aUWAYM6zj0vm1GZ+TQ+tEc0Krf1eM+2DJqAl5SM=; b=0Q4m0MpdPeP+wb6w4Pe51127cWgUI1EXeqSqECjVrvgv44y0Q9BVpuUBNCgO3otWqo xdIICxrNtLSbPHGrH3pg+kGlRS8t4nPlNotfBAES2dY+DIEFCm2NOpBFVYlKguiKyotm n6m77G2K420a/LYoQ4k4MIOqDo97lhTqHPE24NIYNa0Qz+20adEf1blCV9ycDA2kv/ID O9034Mj4GzasGmBF32ion3OWJTONE15mEnyAYanQUcY4HcvFDmIp0t2+2UzKkam4wD+M imi0NiqydrBaPrxWgkFj1IxkAv6vqGw6kIc/fmZ0nTOzmZZC6eg2G0a/xfX58gUKOUcu t8Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=nmW74zEr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x19si11459819pgi.515.2019.07.22.10.29.01; Mon, 22 Jul 2019 10:29:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=nmW74zEr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727564AbfGVPDa (ORCPT + 99 others); Mon, 22 Jul 2019 11:03:30 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:32795 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727480AbfGVPDZ (ORCPT ); Mon, 22 Jul 2019 11:03:25 -0400 Received: by mail-wr1-f67.google.com with SMTP id n9so39864565wru.0 for ; Mon, 22 Jul 2019 08:03:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iAL0aUWAYM6zj0vm1GZ+TQ+tEc0Krf1eM+2DJqAl5SM=; b=nmW74zEr5VJ6NZvm1xuolQHLV0V7JgfFdkjukAjIIj5RNLT84lt5xHJ0PLzrUJ6/ie RmshckVdtRD0zHSnm/JFKySIhGn9lZ2csoJYK8GGTLrpZYKGDFXm1O4UzIVaOn6wT8n+ chPm6jnC6JBpeSfYWVmpy9xzw0ALdoGU0NGnuQGvytC2iIybCom/3uAlMfxOdEEaK5is Cd+Wu0BM+CzQQJq670P51jIIg8jJN+ZLA4mzlt+Ou356KV4WZV4ZhqcfU3aa+vZzLCxy lICAekCDmFT5JKXRYetIaIyTKTQIkoTZKT/ciUHheKR5Fsu7MGdWEjsq1YjAP1YGsQUl gfHQ== 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=iAL0aUWAYM6zj0vm1GZ+TQ+tEc0Krf1eM+2DJqAl5SM=; b=YNGHNR7MKjqZd+4H/MYWhF5AeRgZUWJn986d7snfZ5GAAKdmC4aRBxdMC5EihdyMqz QFTTxoCEHlRB5kpDF+/mcaRkb16Yd59d+v7hpuJqnhSIaONRZ7s7aCQtZB933mohwh0+ v1ET+yFfpDsafy/y5FjsvVg9gOfQLDIdcAEyiNI8Z221pZYmTIgJgoChL7ll3Wqsxf4X FQlP9L5VicUEMIMOsg0pccTbpRQp14T6pydU2wycCQCpjyoxJLxWhCvWyekpxAgKY+Ch tRRIhN81Y2Lu18oynxw6oNZCKckmxqig8+9MvoW9S6pDgWXpzcdeZJU1D0jX6Q+XVBve DKZQ== X-Gm-Message-State: APjAAAWlYp3cDuVHbr3YGV1wr0Y7g4kfiLo7N4ppF91rGDTWIlfv9f8V IikiZBFV9Of+245+Bnux1D0= X-Received: by 2002:a5d:568e:: with SMTP id f14mr30852781wrv.167.1563807803620; Mon, 22 Jul 2019 08:03:23 -0700 (PDT) Received: from localhost.localdomain (amontpellier-652-1-281-69.w109-210.abo.wanadoo.fr. [109.210.96.69]) by smtp.gmail.com with ESMTPSA id v23sm36310460wmj.32.2019.07.22.08.03.22 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 08:03:23 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 7/7] backlight: gpio: use a helper variable for &pdev->dev Date: Mon, 22 Jul 2019 17:03:02 +0200 Message-Id: <20190722150302.29526-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722150302.29526-1-brgl@bgdev.pl> References: <20190722150302.29526-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski Instead of dereferencing pdev each time, use a helper variable for the associated device pointer. Signed-off-by: Bartosz Golaszewski --- drivers/video/backlight/gpio_backlight.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index cd6a75bca9cc..091ff799659a 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -54,29 +54,32 @@ static const struct backlight_ops gpio_backlight_ops = { static int gpio_backlight_probe(struct platform_device *pdev) { - struct gpio_backlight_platform_data *pdata = - dev_get_platdata(&pdev->dev); + struct gpio_backlight_platform_data *pdata; struct backlight_properties props; struct backlight_device *bl; struct gpio_backlight *gbl; enum gpiod_flags flags; + struct device *dev; int ret, def_value; - gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); + dev = &pdev->dev; + pdata = dev_get_platdata(dev); + + gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL); if (gbl == NULL) return -ENOMEM; if (pdata) gbl->fbdev = pdata->fbdev; - def_value = device_property_read_bool(&pdev->dev, "default-on"); + def_value = device_property_read_bool(dev, "default-on"); flags = def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; - gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, flags); + gbl->gpiod = devm_gpiod_get(dev, NULL, flags); if (IS_ERR(gbl->gpiod)) { ret = PTR_ERR(gbl->gpiod); if (ret != -EPROBE_DEFER) { - dev_err(&pdev->dev, + dev_err(dev, "Error: The gpios parameter is missing or invalid.\n"); } return ret; @@ -85,11 +88,10 @@ static int gpio_backlight_probe(struct platform_device *pdev) memset(&props, 0, sizeof(props)); props.type = BACKLIGHT_RAW; props.max_brightness = 1; - bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), - &pdev->dev, gbl, &gpio_backlight_ops, - &props); + bl = devm_backlight_device_register(dev, dev_name(dev), dev, gbl, + &gpio_backlight_ops, &props); if (IS_ERR(bl)) { - dev_err(&pdev->dev, "failed to register backlight\n"); + dev_err(dev, "failed to register backlight\n"); return PTR_ERR(bl); } -- 2.21.0