Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp754143pxk; Thu, 17 Sep 2020 15:37:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxPQzWR4Wtyz/iPiF1GOmrYV9dEWAz/RDJQxooxy0Ot4GWdYXt+KwMhcRDnVTFRBDtK3AR X-Received: by 2002:a17:906:d936:: with SMTP id rn22mr33379540ejb.4.1600382240445; Thu, 17 Sep 2020 15:37:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600382240; cv=none; d=google.com; s=arc-20160816; b=uas2epRn11XjvcdFA0tRLWpm2iWCRpLN/GBEfYrl2/9xyEp2PG2eLSNITrhsbW92MA upR+Se9K9bolcDZ9Dpn4Pt1RDc0h+KUkZ/PfrtWy+pQoUOBtMe5L6gdPiSQwQOMQLW9P jgN9+tBfpwCR865EiyVKb9u0ob3CNSN01Ii6fE8AA+IeaGBV8/4BGJUVpG6NJDKJ8qv7 sB+4WrUFlpU/eOhEFDMfnDYkes87a56zzQWD1dvxBYy+jc4GbIJmqBhugUPUz6bQLHS9 Gh4jFkmlQcjVZAj6//zvH8vbkkSKctdlHORAvPjTV32Ln30CljRfV8hy8LWjOOMGRZuc WpBA== 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=cZgH0ktAheu8mLBCCu5MayU3c42SM4fy7qCvvRljML8=; b=S4Ht/veapOcbTbg1gkydrKnYCnHt1/U3q3AhPHf3bRWiIa6wd2J/QOOQXRrzSC511y +1BfuNtrhFN/uUJH5KNqM7tqO+drVb/mb74oD98fw4wUfhYKdvMOgM6RA95Wp2gv6azr dBUoVskmun7UyzshvxNuyfwlt8aetlIJPCBn/ofA9VTo8U5qFxq+u5T+dSvGdAAGiTaC XmMyuafXJ66GRKraLDiWCxB6DtSUhy4h6lB8KyU01LfDgyqYpAzL354MdPCcJ4cLTyT4 mGSPJY7uhvVVMAaPXvJChPiAJSF6LtH8UZIVUdPPpjgyCg8tgIU3+R0URyZURDw5Vf/x pK+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nic.cz header.s=default header.b=iRVnNu4F; 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=nic.cz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si965652ejy.39.2020.09.17.15.36.57; Thu, 17 Sep 2020 15:37:20 -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=@nic.cz header.s=default header.b=iRVnNu4F; 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=nic.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726401AbgIQWeN (ORCPT + 99 others); Thu, 17 Sep 2020 18:34:13 -0400 Received: from mail.nic.cz ([217.31.204.67]:35842 "EHLO mail.nic.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726216AbgIQWeJ (ORCPT ); Thu, 17 Sep 2020 18:34:09 -0400 Received: from dellmb.labs.office.nic.cz (unknown [IPv6:2001:1488:fffe:6:cac7:3539:7f1f:463]) by mail.nic.cz (Postfix) with ESMTP id 0652E1419F6; Fri, 18 Sep 2020 00:33:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1600382038; bh=eVEEs+3FCmghmvPcW79AsOl6NcLqYrjCH2wd/yFtugk=; h=From:To:Date; b=iRVnNu4FDoqE0CN7TvkhuJw1xfSAhDSIcSZ6JJL2P68v51XuZoRhkY6i6kCg9L7rC gtYL0FabWl5QX+KNoVRuR4zfYfXC7MFRprlWfyeMDevRA4gXBnfZL6+EPtG55WFjmA lGWtPwSA7cscnLRexk9K3x3N78/tqXD4cOspLdd0= From: =?UTF-8?q?Marek=20Beh=C3=BAn?= To: linux-leds@vger.kernel.org Cc: Pavel Machek , Dan Murphy , =?UTF-8?q?Ond=C5=99ej=20Jirman?= , linux-kernel@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, =?UTF-8?q?Marek=20Beh=C3=BAn?= , "H . Nikolaus Schaller" , Grant Feng Subject: [PATCH leds v2 26/50] leds: is31fl319x: don't store shutdown gpio descriptor Date: Fri, 18 Sep 2020 00:33:14 +0200 Message-Id: <20200917223338.14164-27-marek.behun@nic.cz> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200917223338.14164-1-marek.behun@nic.cz> References: <20200917223338.14164-1-marek.behun@nic.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.nic.cz X-Spam-Status: No, score=0.00 X-Spamd-Bar: / X-Virus-Scanned: clamav-milter 0.102.2 at mail X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the shutdown gpio descriptor is only accessed in device probe method there is no need to store it in the private structure. Signed-off-by: Marek BehĂșn Cc: H. Nikolaus Schaller Cc: Grant Feng --- drivers/leds/leds-is31fl319x.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c index ba1a5da5521b5..595112958617e 100644 --- a/drivers/leds/leds-is31fl319x.c +++ b/drivers/leds/leds-is31fl319x.c @@ -63,7 +63,6 @@ struct is31fl319x_chip { const struct is31fl319x_chipdef *cdef; struct i2c_client *client; - struct gpio_desc *shutdown_gpio; struct regmap *regmap; struct mutex lock; u32 audio_gain_db; @@ -227,15 +226,6 @@ static int is31fl319x_parse_dt(struct device *dev, if (!np) return -ENODEV; - is31->shutdown_gpio = devm_gpiod_get_optional(dev, - "shutdown", - GPIOD_OUT_HIGH); - if (IS_ERR(is31->shutdown_gpio)) { - ret = PTR_ERR(is31->shutdown_gpio); - dev_err(dev, "Failed to get shutdown gpio: %d\n", ret); - return ret; - } - is31->cdef = device_get_match_data(dev); count = of_get_available_child_count(np); @@ -355,6 +345,7 @@ static int is31fl319x_probe(struct i2c_client *client, { struct is31fl319x_chip *is31; struct device *dev = &client->dev; + struct gpio_desc *shutdown_gpio; int err; int i = 0; u32 aggregated_led_microamp; @@ -375,18 +366,26 @@ static int is31fl319x_probe(struct i2c_client *client, if (!is31) return -ENOMEM; + shutdown_gpio = gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); + if (IS_ERR(shutdown_gpio)) { + err = PTR_ERR(shutdown_gpio); + dev_err(dev, "Failed to get shutdown gpio: %d\n", err); + return err; + } + + if (shutdown_gpio) { + gpiod_direction_output(shutdown_gpio, 0); + mdelay(5); + gpiod_direction_output(shutdown_gpio, 1); + gpiod_put(shutdown_gpio); + } + mutex_init(&is31->lock); err = is31fl319x_parse_dt(&client->dev, is31); if (err) goto free_mutex; - if (is31->shutdown_gpio) { - gpiod_direction_output(is31->shutdown_gpio, 0); - mdelay(5); - gpiod_direction_output(is31->shutdown_gpio, 1); - } - is31->client = client; is31->regmap = devm_regmap_init_i2c(client, ®map_config); if (IS_ERR(is31->regmap)) { -- 2.26.2