Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2337143ybl; Mon, 20 Jan 2020 00:46:13 -0800 (PST) X-Google-Smtp-Source: APXvYqy9RblAo9mz9yU0udTmcOsQnumxhFb2rjXgr3uKfveIyYL0DVS6pZmsSqw8uhslWetwc1sj X-Received: by 2002:a9d:6c52:: with SMTP id g18mr15291980otq.356.1579509973074; Mon, 20 Jan 2020 00:46:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579509973; cv=none; d=google.com; s=arc-20160816; b=lgeqy6shKHIzgh2uSVcG/9j514cWIBJtyk/Eata9onanotQJsT2Efu/dTzHEgvZSTV DXcFRN8l+q4ORTbXVW4yAH12Z7fQjivqqczhTf+qPQL8DCBvkNYKU/BJihu9YQtKuo4t 3rpF8Xg+fu8f04JI1XXSwtdwml2HCujE5pNSQ7cQY2hcRN5gT4UVzfWIuOjbm2J3OW1i L4AysiPGcS7+XxHY+J67yg5GfLpMo/9Pe7mUfXexw4fVkbEFB5dwZ/se+xTj1fdoTwX4 u6m08O4O9MtFq+09hikMun+W7s1t8OM/p44bVixB0Fw8CvE/gjjjditgHww0PJdQBk/E 5VNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=kdjFDmHpK9XF0winpVoDYfPnYppvi92C4n7zVPl2Zp0=; b=w9mONJVUzYftnR2Me29qwi4ETwbdVVowhpmsapa4D4sakqJMs2Xl8XKfKMJjtchmEa iI4FQQ3V+d4sqB232r6tFTRv2XHOtBpEz6M8lwbRQwySfHsLbOKbIoABSwKBAV7BqkN+ Qw3RwhWzkImVO3Y+DQV5eBJgNvXrfzUD53eNFqXfBGkbDmBfqEscpFN0HRQwk8A+Gd+n VDMfRN5yQB7DfOkhNnFGkclx78ZGfnu42Mg8atE+79gM0whYTIh+e3CDVXw5/QZ9EGDY 0qKCR1xz7SXrhuMKmDN3iBEZQuNsCbZ6jG4Pt3pBBfMvjxHuCGxSgo6yggn0ZLusC155 ewWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e26si20929450otj.113.2020.01.20.00.46.01; Mon, 20 Jan 2020 00:46:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727114AbgATIoz (ORCPT + 99 others); Mon, 20 Jan 2020 03:44:55 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:34007 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgATIoz (ORCPT ); Mon, 20 Jan 2020 03:44:55 -0500 Received: by mail-ot1-f65.google.com with SMTP id a15so27990025otf.1; Mon, 20 Jan 2020 00:44:55 -0800 (PST) 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=kdjFDmHpK9XF0winpVoDYfPnYppvi92C4n7zVPl2Zp0=; b=Iysi9HCj2N98Hk3fWUHzYwuRHmIwoeXmlrRsY5GvEQ+LR1RQaJgyIZQ6U4dj/9ktAs Ig8CsgC5GgIcMxy03L+HRx09nzP5xlVCYTFLSbs0IaaqpOzWKBZ8sU8NmhfV7w7/GZ3a g7utZI0GkaG88IK+koYv4HDxnCdxD78Ftv/8GDoyseSKhw7AgpneOOk2kZHY2OOuX8f0 cQGH+XMWxg5W41xfyI9CyYk1ufBCNJdstDlCVKMfN/T+BiFy94zQhVYMyjU/23Ltwoiy uVJsYKgnJvI+IbnzVqJ+vQ1/BDtztzl9Wa/pNHEL41xJdCvlqK5mo2sLIfUmFeTRubnK bHRg== X-Gm-Message-State: APjAAAVxdZ8EFMLlpVsF8pne6ktHQ51RVi8SeJHtfY1NBairpTJsVEWT Lrndl+gZPZeIBIfJ2rQOta4ilytbTLNccKIZrxo= X-Received: by 2002:a05:6830:2141:: with SMTP id r1mr15192738otd.39.1579509894895; Mon, 20 Jan 2020 00:44:54 -0800 (PST) MIME-Version: 1.0 References: <20191224120709.18247-1-brgl@bgdev.pl> <20191224120709.18247-3-brgl@bgdev.pl> In-Reply-To: <20191224120709.18247-3-brgl@bgdev.pl> From: Geert Uytterhoeven Date: Mon, 20 Jan 2020 09:44:43 +0100 Message-ID: Subject: Re: [PATCH v4 02/13] gpiolib: have a single place of calling set_config() To: Bartosz Golaszewski Cc: Kent Gibson , Linus Walleij , Andy Shevchenko , Greg Kroah-Hartman , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Bartosz Golaszewski , Andy Shevchenko Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bartosz, On Tue, Dec 24, 2019 at 1:08 PM Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Instead of calling the gpiochip's set_config() callback directly and > checking its existence every time - just add a new routine that performs > this check internally. Call it in gpio_set_config() and > gpiod_set_transitory(). Also call it in gpiod_set_debounce() and drop > the check for chip->set() as it's irrelevant to this config option. > > Signed-off-by: Bartosz Golaszewski > Reviewed-by: Andy Shevchenko > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -3042,6 +3042,15 @@ EXPORT_SYMBOL_GPL(gpiochip_free_own_desc); > * rely on gpio_request() having been called beforehand. > */ > > +static int gpio_do_set_config(struct gpio_chip *gc, unsigned int offset, > + enum pin_config_param mode) > +{ > + if (!gc->set_config) > + return -ENOTSUPP; > + > + return gc->set_config(gc, offset, mode); > +} > + > static int gpio_set_config(struct gpio_chip *gc, unsigned int offset, > enum pin_config_param mode) > { > @@ -3060,7 +3069,7 @@ static int gpio_set_config(struct gpio_chip *gc, unsigned int offset, > } > > config = PIN_CONF_PACKED(mode, arg); > - return gc->set_config ? gc->set_config(gc, offset, config) : -ENOTSUPP; > + return gpio_do_set_config(gc, offset, mode); These two lines are not equivalent: the new code no longer uses the packed value of mode and arg! Hence this leads to subsequent cleanups in commits e5e42ad224a040f9 ("gpiolib: remove set but not used variable 'config'") and d18fddff061d2796 ("gpiolib: Remove duplicated function gpio_do_set_config()"). However, what was the purpose of the PIN_CONF_PACKED() translation? Why is it no longer needed? Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds