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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 E62ADC47088 for ; Wed, 26 May 2021 06:10:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C90FF61028 for ; Wed, 26 May 2021 06:10:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232661AbhEZGMH (ORCPT ); Wed, 26 May 2021 02:12:07 -0400 Received: from mail-lj1-f182.google.com ([209.85.208.182]:43718 "EHLO mail-lj1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232679AbhEZGMF (ORCPT ); Wed, 26 May 2021 02:12:05 -0400 Received: by mail-lj1-f182.google.com with SMTP id w15so108097ljo.10; Tue, 25 May 2021 23:10:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/52t2gRhW9uzV6QfWt9pJg3Wnm3JFbOqeAJZ2k4RlFU=; b=fyRkFf4PrW4woyq7CfOVE2UEmIjexRuu6amnDtr9Zj4tBh+XENLOVb6COqAfdVqcSX KlfR03yXpLYF7UXbxUuMq2DOPy2h0RnconfU6Hnrk8dVpO60ufIp+Ngqi128Qt7zjHBs qMJDBpHKGSoxbTDmp7zxQK3HwYiOpD1GYjFTd9FlMSz6vvQT+zgNoTisPUw/x/B6jDD5 8AFguZhOeJiug+Vn0FtH3LF5n/2VXmIppyeM6IZgQs4VfYp7rHTjhzBLewQHtAz4onKm EEEH+TsXdKaB7361MO5E+J/iagz9bd60CS1pb7wHGnXU8z94EfsKWFpnRo56Gu4NNPKa 5/WQ== X-Gm-Message-State: AOAM530cCJdaMWesywyrJEbZ8cz8InT+S9w2r/+WXcEI/X9T1BSiy6S1 1sSgN6onsV6fRnHD4k7JcNI= X-Google-Smtp-Source: ABdhPJx209K6PEaaWkfSPVYea7B2lR8PTN7rHrCkUSSG2K5hpD/OAINI9/52pFf6kiYcAtMhXpItvw== X-Received: by 2002:a2e:8e26:: with SMTP id r6mr1012954ljk.472.1622009431450; Tue, 25 May 2021 23:10:31 -0700 (PDT) Received: from localhost.localdomain (dc7vkhyyyyyyyyyyyyycy-3.rev.dnainternet.fi. [2001:14ba:16e2:8300::4]) by smtp.gmail.com with ESMTPSA id o20sm1929505lfu.283.2021.05.25.23.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 23:10:30 -0700 (PDT) Date: Wed, 26 May 2021 09:10:24 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Linus Walleij , Bartosz Golaszewski , Matti Vaittinen , Michael Walle , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, Jonas Gorski , =?iso-8859-1?Q?=C1lvaro_Fern=E1ndez?= Rojas , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-power@fi.rohmeurope.com, linux-arm-kernel@lists.infradead.org, Andy Shevchenko Subject: [PATCH v4 2/3] gpio: gpio-regmap: Use devm_add_action_or_reset() Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="45Z9DzgjV8m4Oswq" Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org --45Z9DzgjV8m4Oswq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Slightly simplify the devm_gpio_regmap_register() by using the devm_add_action_or_reset(). Signed-off-by: Matti Vaittinen --- Changelog v3: - gpio-regmap: Use the devm_add_action_or_reset() instead of the devm_add_action() --- drivers/gpio/gpio-regmap.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c index 4f0903d1acd5..ce5bc9e0d684 100644 --- a/drivers/gpio/gpio-regmap.c +++ b/drivers/gpio/gpio-regmap.c @@ -341,9 +341,9 @@ void gpio_regmap_unregister(struct gpio_regmap *gpio) } EXPORT_SYMBOL_GPL(gpio_regmap_unregister); =20 -static void devm_gpio_regmap_unregister(struct device *dev, void *res) +static void devm_gpio_regmap_unregister(void *res) { - gpio_regmap_unregister(*(struct gpio_regmap **)res); + gpio_regmap_unregister(res); } =20 /** @@ -361,20 +361,17 @@ struct gpio_regmap *devm_gpio_regmap_register(struct = device *dev, const struct gpio_regmap_config *config, const struct gpio_regmap_ops *ops) { - struct gpio_regmap **ptr, *gpio; - - ptr =3D devres_alloc(devm_gpio_regmap_unregister, sizeof(*ptr), - GFP_KERNEL); - if (!ptr) - return ERR_PTR(-ENOMEM); + struct gpio_regmap *gpio; + int ret; =20 gpio =3D gpio_regmap_register(config, ops); - if (!IS_ERR(gpio)) { - *ptr =3D gpio; - devres_add(dev, ptr); - } else { - devres_free(ptr); - } + + if (IS_ERR(gpio)) + return gpio; + + ret =3D devm_add_action_or_reset(dev, devm_gpio_regmap_unregister, gpio); + if (ret) + return ERR_PTR(ret); =20 return gpio; } --=20 2.25.4 --=20 Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~ Simon says - in Latin please. ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~ Thanks to Simon Glass for the translation =3D]=20 --45Z9DzgjV8m4Oswq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmCt5lAACgkQeFA3/03a ocVAAAf9Hd+5MX2z5ocgegY4FAjPIOTOmYNoc/d/Zmd/kczKdaaOfmjXbH0maFyZ uqYX8ImTi4I3EyzCdsKwXLhIwsgD/qm2gQCb3qFCooHHIAAwMInPTu3dCKOM2ce2 JuqwnbgO73Bgn+BXUZ9zeIBCItf1JL/PI9n6GPZdPawizbpQ3+VSA1JS29h2NAMO QnhZW8RYglQJPnJdpWnopu/zqfBJKgGeKmw1nLPytlIYzxl3avu5jIhuUSkXfzl9 9yW6T45ufoUH/qorKNhRwYDmidromvdrZrpa8J+qrWx/EJ5+ouTK8kPqQ7KJVQVI SdbyT3BlF4R3LN4BEkeqUqpvPWltAQ== =W8bB -----END PGP SIGNATURE----- --45Z9DzgjV8m4Oswq-- 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=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 B64F2C2B9F7 for ; Wed, 26 May 2021 06:12:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D718613D3 for ; Wed, 26 May 2021 06:12:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D718613D3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fi.rohmeurope.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Gjn2pDCi5/s0f2d0TgEzCZvXu40op/yL8QdSlLNA4Fc=; b=E08L9E0uWy+NbmzMbf64XadItJ ZcTWTsPxlbAzeKnPZ7ZJya0gj7vD+jPooqBW402W0QG/CE5OzILHx80lWRI7HJIccS/9Cx7GxhjAc bMNEJZ+OVNERNVhsAl2jPbdEGgZeLV3w95YYwyBeVNA25csSAOiWBHEX0AdldYe9ecAXE0eFhR9SW qQ7PrnHRP3+LXqyS8q2QQx2Tqe3T4nbuSma6A+i0euERzO3vgQIYsVmk5EhCLHU/pW+aq+v0xzx8N 9wNZzqSQiYuWbcm0OzRGF/4cc0JnTHSy1eUuIFOX/Iq4TLkM4GbLhNMLMkGoFCTMssZN6fuSYIZaQ TCWZJJmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1llmkX-00BTN3-Gi; Wed, 26 May 2021 06:10:37 +0000 Received: from mail-lj1-f175.google.com ([209.85.208.175]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1llmkT-00BTKm-9S for linux-arm-kernel@lists.infradead.org; Wed, 26 May 2021 06:10:34 +0000 Received: by mail-lj1-f175.google.com with SMTP id e2so133668ljk.4 for ; Tue, 25 May 2021 23:10:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/52t2gRhW9uzV6QfWt9pJg3Wnm3JFbOqeAJZ2k4RlFU=; b=O45zIuag0d/YRZ/ZzJuFcAvKct/Q9BqB8Gv0/e4ZvUKkef7z7rON0FABOGW2Mtl6bq Fr0VdhJsCvSbuTbMQIYH0XqctqmwYyYZeu6SKG53JMgaNgBIupAZEReKNRHJfaEb/5QX hc8v62miP5WHs/oaBzAbTUzTnMG5fEJiU7z+jnISf5nvXYDU+E5S79sya4AeBL2gSjab GRA5j9oDmnt7d8+9NCeJIDvC9lXrxIZosisjXM31Ae74MssHXvP6JQHbdw2r3oQJKcKM WjqLPAO+L/riXNg0uUqz2++FJQDMQUE13bR30cP1UZVNmdvFJtRSTpHcuS4XvnOPM/zt KjGA== X-Gm-Message-State: AOAM532iT9pIXEzXNcudG0QeZnNJOUmkzyqvpK0SIJif1whs41X86hVX rMPBziuCHJnf0q2XJuj+Ahk= X-Google-Smtp-Source: ABdhPJx209K6PEaaWkfSPVYea7B2lR8PTN7rHrCkUSSG2K5hpD/OAINI9/52pFf6kiYcAtMhXpItvw== X-Received: by 2002:a2e:8e26:: with SMTP id r6mr1012954ljk.472.1622009431450; Tue, 25 May 2021 23:10:31 -0700 (PDT) Received: from localhost.localdomain (dc7vkhyyyyyyyyyyyyycy-3.rev.dnainternet.fi. [2001:14ba:16e2:8300::4]) by smtp.gmail.com with ESMTPSA id o20sm1929505lfu.283.2021.05.25.23.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 23:10:30 -0700 (PDT) Date: Wed, 26 May 2021 09:10:24 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Linus Walleij , Bartosz Golaszewski , Matti Vaittinen , Michael Walle , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, Jonas Gorski , =?iso-8859-1?Q?=C1lvaro_Fern=E1ndez?= Rojas , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-power@fi.rohmeurope.com, linux-arm-kernel@lists.infradead.org, Andy Shevchenko Subject: [PATCH v4 2/3] gpio: gpio-regmap: Use devm_add_action_or_reset() Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210525_231033_375911_8D3AAF0F X-CRM114-Status: GOOD ( 16.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============3078048424290468380==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============3078048424290468380== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="45Z9DzgjV8m4Oswq" Content-Disposition: inline --45Z9DzgjV8m4Oswq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Slightly simplify the devm_gpio_regmap_register() by using the devm_add_action_or_reset(). Signed-off-by: Matti Vaittinen --- Changelog v3: - gpio-regmap: Use the devm_add_action_or_reset() instead of the devm_add_action() --- drivers/gpio/gpio-regmap.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c index 4f0903d1acd5..ce5bc9e0d684 100644 --- a/drivers/gpio/gpio-regmap.c +++ b/drivers/gpio/gpio-regmap.c @@ -341,9 +341,9 @@ void gpio_regmap_unregister(struct gpio_regmap *gpio) } EXPORT_SYMBOL_GPL(gpio_regmap_unregister); =20 -static void devm_gpio_regmap_unregister(struct device *dev, void *res) +static void devm_gpio_regmap_unregister(void *res) { - gpio_regmap_unregister(*(struct gpio_regmap **)res); + gpio_regmap_unregister(res); } =20 /** @@ -361,20 +361,17 @@ struct gpio_regmap *devm_gpio_regmap_register(struct = device *dev, const struct gpio_regmap_config *config, const struct gpio_regmap_ops *ops) { - struct gpio_regmap **ptr, *gpio; - - ptr =3D devres_alloc(devm_gpio_regmap_unregister, sizeof(*ptr), - GFP_KERNEL); - if (!ptr) - return ERR_PTR(-ENOMEM); + struct gpio_regmap *gpio; + int ret; =20 gpio =3D gpio_regmap_register(config, ops); - if (!IS_ERR(gpio)) { - *ptr =3D gpio; - devres_add(dev, ptr); - } else { - devres_free(ptr); - } + + if (IS_ERR(gpio)) + return gpio; + + ret =3D devm_add_action_or_reset(dev, devm_gpio_regmap_unregister, gpio); + if (ret) + return ERR_PTR(ret); =20 return gpio; } --=20 2.25.4 --=20 Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~ Simon says - in Latin please. ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~ Thanks to Simon Glass for the translation =3D]=20 --45Z9DzgjV8m4Oswq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmCt5lAACgkQeFA3/03a ocVAAAf9Hd+5MX2z5ocgegY4FAjPIOTOmYNoc/d/Zmd/kczKdaaOfmjXbH0maFyZ uqYX8ImTi4I3EyzCdsKwXLhIwsgD/qm2gQCb3qFCooHHIAAwMInPTu3dCKOM2ce2 JuqwnbgO73Bgn+BXUZ9zeIBCItf1JL/PI9n6GPZdPawizbpQ3+VSA1JS29h2NAMO QnhZW8RYglQJPnJdpWnopu/zqfBJKgGeKmw1nLPytlIYzxl3avu5jIhuUSkXfzl9 9yW6T45ufoUH/qorKNhRwYDmidromvdrZrpa8J+qrWx/EJ5+ouTK8kPqQ7KJVQVI SdbyT3BlF4R3LN4BEkeqUqpvPWltAQ== =W8bB -----END PGP SIGNATURE----- --45Z9DzgjV8m4Oswq-- --===============3078048424290468380== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============3078048424290468380==--