From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05A5FC7618B for ; Tue, 23 Jul 2019 15:34:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D79BF218B8 for ; Tue, 23 Jul 2019 15:34:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387632AbfGWPec (ORCPT ); Tue, 23 Jul 2019 11:34:32 -0400 Received: from mga11.intel.com ([192.55.52.93]:23892 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbfGWPec (ORCPT ); Tue, 23 Jul 2019 11:34:32 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jul 2019 08:34:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,299,1559545200"; d="scan'208";a="174578077" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.145]) by orsmga006.jf.intel.com with ESMTP; 23 Jul 2019 08:34:28 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hpwo6-0004It-9g; Tue, 23 Jul 2019 18:34:26 +0300 Date: Tue, 23 Jul 2019 18:34:26 +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 Mailing List , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v2 7/7] backlight: gpio: use a helper variable for &pdev->dev Message-ID: <20190723153426.GL9224@smile.fi.intel.com> References: <20190722150302.29526-1-brgl@bgdev.pl> <20190722150302.29526-8-brgl@bgdev.pl> <20190722160908.GZ9224@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Tue, Jul 23, 2019 at 08:29:52AM +0200, Bartosz Golaszewski wrote: > pon., 22 lip 2019 o 18:09 Andy Shevchenko > napisaƂ(a): > > > > On Mon, Jul 22, 2019 at 05:03:02PM +0200, Bartosz Golaszewski wrote: > > > From: Bartosz Golaszewski > > > > > > Instead of dereferencing pdev each time, use a helper variable for > > > the associated device pointer. > > > > > 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; > > > > Can't we do > > > > struct device dev = &pdev->dev; > > struct gpio_backlight_platform_data *pdata = dev_get_platdata(dev); > > > > ? It fits 80 nicely. > > > > IMO it's more readable like that with the reverse christmas tree layout. It makes more churn in the original code and for initializers the order is defined by its nature. -- With Best Regards, Andy Shevchenko