Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1404032pxj; Fri, 21 May 2021 13:25:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRc54SjDUTjx2EfnvbpwM9oCl6Y+oI2wPXBKhbTohSkT9iHUWM2MTHr0yL8AqIvN1YjT2w X-Received: by 2002:a05:6e02:1252:: with SMTP id j18mr583195ilq.205.1621628744198; Fri, 21 May 2021 13:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621628744; cv=none; d=google.com; s=arc-20160816; b=WJP++HGYoJENsLGI8Bkly8lfg6ukOy7AjVfWD4/RULOwDdxGmcT4vg4Ts9IYj4fbnb Nxj6TPLgM9sX+ywFjU0PCUuWoekPYcWJnPCUeZM2uJ75c4H7uSI/O571J0IQZC0a+EMy AnSotTugeNTQf9PUseuQhmi4lROIkodkO/Hpahct7JWjbZXQ3tlxZWEx2M2I+kmEERFc ZwFrsoO0ujRKEy6/HTtY/Qf1Tghi1az8a9TBxLGX93aiwVPefo+FgNpKwsv69+wxWayL JXANZH+1XG9ukHAZ6kk/6iKV4lW9Aei8oTNYCVcO3FE1d9D+ghrReNNbDFcBDZeR1srO XVSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SkEvVmINwYubZELrUT2CAhIwBMJX/lCcLqqTvO92lSY=; b=d2uhOr+/lYAW4YSsrL4roOEWlF8xYb3/W4RvoDxNr+fYEEujzyD3FQl8UBjx6vhrKZ PT+LntKC7oXrnkLbJC3A3cZZeU41r2VPj65Wgp84EpIfWCnRwfHfrZg1JXTuRsdngCFJ ypDvuqwwH4qL+VKC1OT/zNFc8SStNvf4fsZLBXfQy78tMgLE+3fFu0BuseE1QRhDtEPr 8ObmS7R4b5SsLIQTbfw8yv5rtMxbpNjEeE8OhPa1E5XzmQ6J1xxpZQ2AWjIWaF4mY2gg S2nZcda96kfwWbDRKR7BaGdsL0FfrrgJzVzLdcKUzM1arJ7Rxrr5gxvwgmJ7jySww7/H Aciw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=f9aZx6E8; 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=deviqon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si6463359iln.71.2021.05.21.13.25.27; Fri, 21 May 2021 13:25:44 -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=@deviqon.com header.s=google header.b=f9aZx6E8; 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=deviqon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235968AbhEURrl (ORCPT + 99 others); Fri, 21 May 2021 13:47:41 -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-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