Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3047099ybt; Mon, 29 Jun 2020 13:52:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyY62/egWSASasTIH0w8z1aI3UnScrvbt6xOckDpi9Kuw7IliFa3mFhRz0TctJW6l/NGRhP X-Received: by 2002:a17:906:7746:: with SMTP id o6mr16001963ejn.75.1593463937586; Mon, 29 Jun 2020 13:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593463937; cv=none; d=google.com; s=arc-20160816; b=lp9F1aZF0/2zpvAnBnBrdo2erKLzVxkRVvQi84JT1WdNJXPSmec2isOxBHF9fmShIf 8IExnyMEpPvCA+m0bCtAazNu6IZ8VzYnyql6vp0cKNKd74X+ZOBsPXgysWMuM40me5Sj TVCjQmbDbrPnaUDYDZyWS7MYMxShyV0keC046dUGLPlRUPF598YDhcZex80pHoc+iWyQ IEkA0LMHcD35SHM5HDuJ01longeSkVUQoZ7zw+9lwVlpUDmNLTQy5w7F/Ui6EScE6akb zIHwQn1Ou/qXwVvpxg8TbIZrtMviHkSlQ2+U32dKpOUkKHANF3svRW8lc63QmZsMY7vX THVw== 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:dkim-signature; bh=rA9epWFsG5fbaq7o7Q/6VMPdIfht3K/e6mhw2OtNl9U=; b=QUhn13zzStwuf83o2y915w5TRoSao9nPGIVfaQMkHM6XkzZeFe3SQhAJGn2ppqAZ/E 8u6hOSnNvjv1NDV7sB9IroOBRXGwIOt0T2M4DymP945/6iFewHj0tIYraETM4sezovgf IR25f2PsO6f2v95wTtDIULi+2jxADRyfmRFd0K8w4m85GPTHIoEYG/xRBf3VSzhmenle JQco0xLXtkAgNbblFZbeDtJm9jnnyHsK466zM93gdqm5Pe9TfExUrwMeqycf6MdBNaKk Nwn8XXjB4MO7ZCiDVZAhtI3EvQAj9OVObtUWxDN+BmcRcj3nG+F/M3lNHkQuK8b07V6V Rd2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=hzAE1Yat; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si385665ejj.564.2020.06.29.13.51.54; Mon, 29 Jun 2020 13:52:17 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=hzAE1Yat; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731574AbgF2Usy (ORCPT + 99 others); Mon, 29 Jun 2020 16:48:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731514AbgF2TNs (ORCPT ); Mon, 29 Jun 2020 15:13:48 -0400 Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64727C02E2ED for ; Mon, 29 Jun 2020 07:25:34 -0700 (PDT) Received: by mail-qv1-xf42.google.com with SMTP id g11so7706228qvs.2 for ; Mon, 29 Jun 2020 07:25:34 -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=rA9epWFsG5fbaq7o7Q/6VMPdIfht3K/e6mhw2OtNl9U=; b=hzAE1YatrpkZQ7jnLFTXC8QY7HnN+hfZ399QqsJj7tLxfrFjf06NFKvZC3HpmfReQp krbHWZ2eodd+i28Exn1eMViNZl5pZF8YjqxUIdxufGNDPnYmPT0wjM7iRV2Vhj9glwiT mue+E8bAcJT9UOHzRlon78YuZHExdmyPWuszUPv5VOhRcXZB8AcNSnN8ZOQWOG4zwIdf YyoKPksd/nqs+8RjLK6vO7rmQPQ1QbcuvqXHYuv3nmyXJfYQ1PnQ8Ogx3tE/dTldtFPy YtLYEPzGwTasDiDtR6fgVB38skKLMGn4YAcPaGeU9yLKq1l6hS7+xyNMpYGTttxgUvqu jy4w== 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=rA9epWFsG5fbaq7o7Q/6VMPdIfht3K/e6mhw2OtNl9U=; b=kf220Or4WqhRXfkjiLDf/umKJV43ad0JzPBY+Roo3/0VRbRhDAUNw+veKsslTjEtGc d7IoeVQEg0BdNhgm+2/k1JMZJuM8muy4HHjc8hMwUk4159Jkpf329h6VK1TKgDFkXGDx gdzVH9fOENxgYH0PfhGLIhPAy8yTJ2KrmOtUxFe6qJ+cANUvOoq9j7sHbd9C9s/rP+nl SjjJutGh2x3AQ3+WMKDNBXJhk/+RUjiPNPSvjCUfZ2OC3rFa8kU1xILVCDy3tzrOPE7I UxEzoRjcBV/V+wjvUmbBUkNgvoFXhLiJfwU1HsspUZZj4JxN1f4puGdUn+LOsVUwyli0 hE8Q== X-Gm-Message-State: AOAM530GIh1ul2SQyfyk5jzXqnM4NLxPlgn5kMUCJ1mhmbdT6tJv5uUR LGTG20uADoSk00SLgL/K38IE5qxAO3KLX2jtBmH+cQ== X-Received: by 2002:a0c:ec04:: with SMTP id y4mr12044188qvo.148.1593440733466; Mon, 29 Jun 2020 07:25:33 -0700 (PDT) MIME-Version: 1.0 References: <20200623040107.22270-1-warthog618@gmail.com> <20200623040107.22270-15-warthog618@gmail.com> In-Reply-To: <20200623040107.22270-15-warthog618@gmail.com> From: Bartosz Golaszewski Date: Mon, 29 Jun 2020 16:25:22 +0200 Message-ID: Subject: Re: [PATCH 14/22] gpiolib: make cdev a build option To: Kent Gibson Cc: LKML , linux-gpio , Linus Walleij 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 On Tue, Jun 23, 2020 at 6:02 AM Kent Gibson wrote: > > Make the gpiolib-cdev module a build option. This allows the CDEV > interface to be removed from the kernel to reduce kernel size in > applications where is it not required, and provides the parent for > other other CDEV interface specific build options to follow. > > Suggested-by: Bartosz Golaszewski > Signed-off-by: Kent Gibson > > --- > drivers/gpio/Kconfig | 16 ++++++++++++++-- > drivers/gpio/Makefile | 2 +- > drivers/gpio/gpiolib-cdev.h | 15 +++++++++++++++ > 3 files changed, 30 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig > index c6b5c65c8405..affc1524bc2c 100644 > --- a/drivers/gpio/Kconfig > +++ b/drivers/gpio/Kconfig > @@ -66,8 +66,20 @@ config GPIO_SYSFS > > This ABI is deprecated. If you want to use GPIO from userspace, > use the character device /dev/gpiochipN with the appropriate > - ioctl() operations instead. The character device is always > - available. > + ioctl() operations instead. > + > +config GPIO_CDEV > + bool "/dev/gpiochipN (character device interface)" > + default y > + help > + Say Y here to add the character device /dev/gpiochipN interface > + for GPIOs. The character device allows userspace to control GPIOs > + using ioctl() operations. > + > + Only say N is you are sure that the GPIO character device is not > + required. > + > + If unsure, say Y. > > config GPIO_GENERIC > depends on HAS_IOMEM # Only for IOMEM drivers > diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile > index ef666cfef9d0..45eb09808d12 100644 > --- a/drivers/gpio/Makefile > +++ b/drivers/gpio/Makefile > @@ -7,8 +7,8 @@ obj-$(CONFIG_GPIOLIB) += gpiolib.o > obj-$(CONFIG_GPIOLIB) += gpiolib-devres.o > obj-$(CONFIG_GPIOLIB) += gpiolib-legacy.o > obj-$(CONFIG_GPIOLIB) += gpiolib-devprop.o > -obj-$(CONFIG_GPIOLIB) += gpiolib-cdev.o > obj-$(CONFIG_OF_GPIO) += gpiolib-of.o > +obj-$(CONFIG_GPIO_CDEV) += gpiolib-cdev.o > obj-$(CONFIG_GPIO_SYSFS) += gpiolib-sysfs.o > obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o > > diff --git a/drivers/gpio/gpiolib-cdev.h b/drivers/gpio/gpiolib-cdev.h > index 973578e7ad10..19a4e3d57120 100644 > --- a/drivers/gpio/gpiolib-cdev.h > +++ b/drivers/gpio/gpiolib-cdev.h > @@ -5,7 +5,22 @@ > > #include > > +#ifdef CONFIG_GPIO_CDEV > + > int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt); > void gpiolib_cdev_unregister(struct gpio_device *gdev); > > +#else > + > +static inline int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt) > +{ > + return 0; > +} > + > +static inline void gpiolib_cdev_unregister(struct gpio_device *gdev) > +{ > +} > + > +#endif /* CONFIG_GPIO_CDEV */ > + > #endif /* GPIOLIB_CDEV_H */ > -- > 2.27.0 > I know Linus doesn't like this, but I'm personally in favor of adding this as long as it's enabled by default. Reviewed-by: Bartosz Golaszewski