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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 C2370C4707C for ; Fri, 21 May 2021 17:46:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A425861261 for ; Fri, 21 May 2021 17:46:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238391AbhEURrm (ORCPT ); Fri, 21 May 2021 13:47:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235694AbhEURrk (ORCPT ); Fri, 21 May 2021 13:47:40 -0400 Received: from mail-vk1-xa34.google.com (mail-vk1-xa34.google.com [IPv6:2607:f8b0:4864:20::a34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3DB3C0613CE for ; Fri, 21 May 2021 10:46:15 -0700 (PDT) Received: by mail-vk1-xa34.google.com with SMTP id u205so4454727vke.10 for ; Fri, 21 May 2021 10:46:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=deviqon.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SkEvVmINwYubZELrUT2CAhIwBMJX/lCcLqqTvO92lSY=; b=f9aZx6E8jIIR5nYx9d/YJX/+u6uNBlgr2xe3NWhvUTwqMUK9UNh+hSElncvK4RTVdW Y4bMGIcAVePovVZf3tZguUSINPWI2bINlUuKaEtQUsi/w7G+WJPpL2V51gRp9pufuqid 4m/ch3YZ6TzKlo5O8U8unhhZe+lrgIlqictdxHkwdJcXw27tWVC1GIHH1z4xXrRZ8eN9 ja+el01rum/DfWcXvyUO8BD3x5Fx1hXxDk+DhGK1elwO8aP9zFHnAEPAjsE6iYqgI6+8 JIbyEjelnovYFd3Rm7g0HBdWK1kK3u0P0iOgPIuJH+vVFGaLtQoYAEg0v1JphDtjfShs abJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SkEvVmINwYubZELrUT2CAhIwBMJX/lCcLqqTvO92lSY=; b=MeQ4Zx7MVdZp8DvJrfwOgZk6zixICeWYMQttleibE0ORPNuEj8XKeGtZ7U/AlOHlhh hXTF1WVKvsBZlf0M83xE8SA6ZxHG2FQmC4NDqBHzPdQensRRsEkALboQHvbCrehzlW3Q djgC9XXYxGZ9mCiH7f7sQLRYqFlezld08dI+C4vzeHBrK1ZW87vpSaDIGlEN+YNIHdVb mEFE7wSRV8GDU+OKiKt3HNeBRm6aoHNr81r1nXL8LS96aUXwFoTLPuTsjUsg4aH2Ljep X68dHxbrAXtOhUOUKZkM943wA9k4/4zAju48OLV9BhhiYgsGwDS6qwhnJ88/fUwc3lxw 00bA== X-Gm-Message-State: AOAM533QwnvppbqayfcKrND9dalIkl4XXoo8ECRcSvX6Do1QAgvdczSs Lm9IygI+iyoEZ/7UtI6FIHqlTvtlCDiFEPMsmfZICg== X-Google-Smtp-Source: ABdhPJz4CBpFHUfT+yqDd2IndBLJfLssD18rbmXPN614JrBwyhtn3U76HjK/SRxbZhQ44l538xeE7tIgf7EOZhWGnvk= X-Received: by 2002:a1f:5506:: with SMTP id j6mr11944560vkb.7.1621619174763; Fri, 21 May 2021 10:46:14 -0700 (PDT) MIME-Version: 1.0 References: <20210514094108.28890-1-aardelean@deviqon.com> In-Reply-To: From: Alexandru Ardelean Date: Fri, 21 May 2021 20:46:03 +0300 Message-ID: Subject: Re: [PATCH] gpio: gpio-tps68470: remove platform_set_drvdata() + cleanup probe To: Bartosz Golaszewski Cc: linux-gpio , LKML , Linus Walleij Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 May 2021 at 16:52, Bartosz Golaszewski wrote: > > On Fri, May 14, 2021 at 11:41 AM Alexandru Ardelean > wrote: > > > > The platform_set_drvdata() call is only useful if we need to retrieve back > > the private information. > > Since the driver doesn't do that, it's not useful to have it. > > > > If this is removed, we can also just do a direct return on > > devm_gpiochip_add_data(). We don't need to print that this call failed as > > there are other ways to log/see this during probe. > > > > Signed-off-by: Alexandru Ardelean > > --- > > drivers/gpio/gpio-tps68470.c | 12 +----------- > > 1 file changed, 1 insertion(+), 11 deletions(-) > > > > diff --git a/drivers/gpio/gpio-tps68470.c b/drivers/gpio/gpio-tps68470.c > > index f7f5f770e0fb..423b7bc30ae8 100644 > > --- a/drivers/gpio/gpio-tps68470.c > > +++ b/drivers/gpio/gpio-tps68470.c > > @@ -125,7 +125,6 @@ static const char *tps68470_names[TPS68470_N_GPIO] = { > > static int tps68470_gpio_probe(struct platform_device *pdev) > > { > > struct tps68470_gpio_data *tps68470_gpio; > > - int ret; > > > > tps68470_gpio = devm_kzalloc(&pdev->dev, sizeof(*tps68470_gpio), > > GFP_KERNEL); > > @@ -146,16 +145,7 @@ static int tps68470_gpio_probe(struct platform_device *pdev) > > tps68470_gpio->gc.base = -1; > > tps68470_gpio->gc.parent = &pdev->dev; > > > > - ret = devm_gpiochip_add_data(&pdev->dev, &tps68470_gpio->gc, > > - tps68470_gpio); > > - if (ret < 0) { > > - dev_err(&pdev->dev, "Failed to register gpio_chip: %d\n", ret); > > - return ret; > > - } > > - > > - platform_set_drvdata(pdev, tps68470_gpio); > > - > > - return ret; > > + return devm_gpiochip_add_data(&pdev->dev, &tps68470_gpio->gc, tps68470_gpio); > > } > > > > static struct platform_driver tps68470_gpio_driver = { > > -- > > 2.31.1 > > > > Applied. I got confused by the dev_get_drvdata() call earlier in probe > but this one's for the parent. Yes. I initially got confused as well about it. This pattern seems to be similar in other drivers as well; usually MFD devices. > > Thanks, > Bart