Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9693658ybi; Wed, 24 Jul 2019 08:22:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRsx1kXAhEwj8w28vAvB00e/9BXZT+gDXuNId3/mb9Wp7ZYhX/HBnA9Wz2B32Y/edGWJUF X-Received: by 2002:a63:5459:: with SMTP id e25mr17023847pgm.366.1563981733276; Wed, 24 Jul 2019 08:22:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563981733; cv=none; d=google.com; s=arc-20160816; b=GQRmWW+0iMysKY3PfQksPe1wfRXU1vHyjPRYEY5RwB+3Pn3rZ28OIqJnT9JsQvkwzj Yth5mv+cLVF6t3t8hw06QLGSh31v10iwz7Yx2O47hbkIINg7cbS+JVF2D7pqdPd1iC39 QmGyvljTxLRkmbp/0uzMfWXNZeVwDr0+mxE6A5jIyTx9s6PGmYHR3xSokIWx+uCRwQ/x bLFGNRTONkk4E+6tyHib8yA2ZPFv0a1UuHX458MnCQWHseZncgWnKVjTFBQ1WZSKddBw C08SIMXgGYpCIJiSFU1jT1epgKXaGKmhzJ7ybVmTnnV4S4OeJRATXxbWWrpkhbhzsaqf 2Scg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=eM+uu8QqKy2tZf/dPm7PQYJqrKRTpNIvLR5rSdRwAYA=; b=PH311emr8MlzQojDOJBeiwVucRqduHcA+I9WpnW9Bzgbnz3YruR5WwcIoEF+gVl4JT AmVI11V4K7Qi3NEz6JIlJEGSlrfvk1LilHMikeHQg1hJETtMTSLC9R/QGGI3kPB2Lntm YhIL4/u2Ur+k+osqm7xsGiNTTwohQ76dm4DLRiEmPbTF8UZV2sQvzIc5UEr86WERD9XH 4nlz0WSjw4XWIew3jK3v0Eys/8LQxrxxdIB8uODGlZAjIKRUZ5k/fWm8iAROx3IWbdIL 5yJ/UKNygGg/crpihaeMQkyQkMGt/JNMcvB6lP/+8X9ajLrX8IzOETAYvr+Y1rHLUjBv sfFg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si15656005pjb.91.2019.07.24.08.21.57; Wed, 24 Jul 2019 08:22:13 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727738AbfGXLl5 (ORCPT + 99 others); Wed, 24 Jul 2019 07:41:57 -0400 Received: from mga06.intel.com ([134.134.136.31]:16210 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727378AbfGXLl5 (ORCPT ); Wed, 24 Jul 2019 07:41:57 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jul 2019 04:41:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,302,1559545200"; d="scan'208";a="160538152" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.145]) by orsmga007.jf.intel.com with ESMTP; 24 Jul 2019 04:41:52 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hqFeZ-0006Bz-1K; Wed, 24 Jul 2019 14:41:51 +0300 Date: Wed, 24 Jul 2019 14:41:51 +0300 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v3 7/7] backlight: gpio: use a helper variable for &pdev->dev Message-ID: <20190724114151.GW9224@smile.fi.intel.com> References: <20190724082508.27617-1-brgl@bgdev.pl> <20190724082508.27617-8-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190724082508.27617-8-brgl@bgdev.pl> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 24, 2019 at 10:25:08AM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Instead of dereferencing pdev each time, use a helper variable for > the associated device pointer. Reviewed-by: Andy Shevchenko > > Signed-off-by: Bartosz Golaszewski > --- > drivers/video/backlight/gpio_backlight.c | 19 +++++++++---------- > 1 file changed, 9 insertions(+), 10 deletions(-) > > diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c > index cd6a75bca9cc..7dc4f90d926b 100644 > --- a/drivers/video/backlight/gpio_backlight.c > +++ b/drivers/video/backlight/gpio_backlight.c > @@ -54,29 +54,29 @@ 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 device *dev = &pdev->dev; > + struct gpio_backlight_platform_data *pdata = dev_get_platdata(dev); > struct backlight_properties props; > struct backlight_device *bl; > struct gpio_backlight *gbl; > enum gpiod_flags flags; > int ret, def_value; > > - gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); > + 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 +85,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 > -- With Best Regards, Andy Shevchenko