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.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 7B8D8C43460 for ; Fri, 21 May 2021 13:52:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C3046008E for ; Fri, 21 May 2021 13:52:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236258AbhEUNyN (ORCPT ); Fri, 21 May 2021 09:54:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236275AbhEUNyD (ORCPT ); Fri, 21 May 2021 09:54:03 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47C03C061763 for ; Fri, 21 May 2021 06:52:40 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id y36so10967159ybi.11 for ; Fri, 21 May 2021 06:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hYyazQCV7o9/2ffX8oGQlM25PnfYmuFFZClG9zAHqJc=; b=j/wmMDvq3difoHoU5SX0tyjbMB5bynTLuxWgfvvtxkWX6KYClGT/XVAMt+3Q221+BW hUBbNCQPDDiVyNNOFrjU/y69OQOzSs1NaBK4JJBul8oUQeBXOJtlD1kCpP6/0QLVyM4Q cLUhO6zRZwgHZ+/SM1SlF0Ab7t9ZusWM/sobTQmE22BaPG9LA1kbUGv6uHwsvL59iO3A t3SzLIAoDbfUGdW9OctPBQ9pVE3QvVDxvFitxOktBTd9NjGiPn0+Y3f9qTa93h8BbxkD xhue1VzAJhcaoSGbx636t1B8FHniYtFHwrfUQliTMKRgi2TZ53L8X7WNs3AtQa4inNmO 6S+w== 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=hYyazQCV7o9/2ffX8oGQlM25PnfYmuFFZClG9zAHqJc=; b=QYFl/TGKHp9xfLj3z5LtDT4rT0RQQzWorPANMYceLY+wKQo1gLdGnt/lr9g3XxGEUC wgJC0YCr9opqBma7DhFD7Qa65OJylRDuTCdXXO1erMmdYjVvvS0iDbhLZvua5Hd4KhcB xdrhUTrjBc5tYoQwBf6mPVhT4maPGhSXWpVf3Vy05xoUxRG2nSCaAsZDBvUdg8NpGob6 szHiQvvxGVuQTOJYP5q9syd/UDyKeCtuJ5cPCzjsr5w3my7jgVgmpO/VXhGBcWJOYYTt q5Fp3KIE0CnSgdeTIYMmRT25ohU28fsAkOitO07Yck5PbLXHA+hmuYYcO0yc1NlQcTTy m1dg== X-Gm-Message-State: AOAM533wKJUtYUiPrwy1Xl1FpAUPDsNZ0jRlYAi4o68l1MYotz3cgxow CnsEZbAYHQCbnMAGIZfmSsWrKila/ho7NZvzBT9EgISF3XFaeEaM X-Google-Smtp-Source: ABdhPJy3kkuAHHd98B11lrxrq9K6DHkYZ0z6vF25s6RHXk7bi60FZKix45bdB3moE7LYh9l8X2S/jPZOAZ3Bp/en79A= X-Received: by 2002:a25:bd04:: with SMTP id f4mr15874966ybk.302.1621605159628; Fri, 21 May 2021 06:52:39 -0700 (PDT) MIME-Version: 1.0 References: <20210514094108.28890-1-aardelean@deviqon.com> In-Reply-To: <20210514094108.28890-1-aardelean@deviqon.com> From: Bartosz Golaszewski Date: Fri, 21 May 2021 15:52:29 +0200 Message-ID: Subject: Re: [PATCH] gpio: gpio-tps68470: remove platform_set_drvdata() + cleanup probe To: Alexandru Ardelean 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, 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. Thanks, Bart