From patchwork Wed Nov 29 11:07:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 10081881 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 270DF60353 for ; Wed, 29 Nov 2017 11:07:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 236F4295DC for ; Wed, 29 Nov 2017 11:07:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 181292974A; Wed, 29 Nov 2017 11:07:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EED6295DC for ; Wed, 29 Nov 2017 11:07:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752820AbdK2LHk (ORCPT ); Wed, 29 Nov 2017 06:07:40 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:55266 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752585AbdK2LHi (ORCPT ); Wed, 29 Nov 2017 06:07:38 -0500 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990477AbdK2LHhyb4tI (ORCPT ); Wed, 29 Nov 2017 12:07:37 +0100 Date: Wed, 29 Nov 2017 12:07:36 +0100 From: Ladislav Michl To: linux-input@vger.kernel.org Cc: Dmitry Torokhov Subject: [PATCH 1/2] Input: gpio-beeper: use helper variable to access device info Message-ID: <20171129110736.GB24064@lenoch> References: <20171129110627.GA24064@lenoch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20171129110627.GA24064@lenoch> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Using explicit struct device variable makes code a bit more readable. Signed-off-by: Ladislav Michl --- Note: and it become more usefull one patch later drivers/input/misc/gpio-beeper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/gpio-beeper.c b/drivers/input/misc/gpio-beeper.c index 16272fffeb7e..409c85da71c3 100644 --- a/drivers/input/misc/gpio-beeper.c +++ b/drivers/input/misc/gpio-beeper.c @@ -64,18 +64,19 @@ static void gpio_beeper_close(struct input_dev *input) static int gpio_beeper_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct gpio_beeper *beep; struct input_dev *input; - beep = devm_kzalloc(&pdev->dev, sizeof(*beep), GFP_KERNEL); + beep = devm_kzalloc(dev, sizeof(*beep), GFP_KERNEL); if (!beep) return -ENOMEM; - beep->desc = devm_gpiod_get(&pdev->dev, NULL, GPIOD_OUT_LOW); + beep->desc = devm_gpiod_get(dev, NULL, GPIOD_OUT_LOW); if (IS_ERR(beep->desc)) return PTR_ERR(beep->desc); - input = devm_input_allocate_device(&pdev->dev); + input = devm_input_allocate_device(dev); if (!input) return -ENOMEM;