Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2048501pxk; Sat, 5 Sep 2020 06:54:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHI7TMJq1QQWUy5DJjQBaAXT4whMiU3JTOMr7AqqDNpjaVtJPBzLh+YhhygMpPWilQN978 X-Received: by 2002:a17:906:cd0d:: with SMTP id oz13mr12347150ejb.212.1599314048829; Sat, 05 Sep 2020 06:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599314048; cv=none; d=google.com; s=arc-20160816; b=QEUa8bvTPeG0dag0g8HwUs4Qc4gs/Ef50L4CrILZ9F5jCzGBifhYt3gaxm5TLT3Zju f9L8njrIyxSrFEOJ9OL08W7CAkWJL3fJujj7rOJByJAp7I1OtujItL43IIcAF7pu9b7T 9r5TyKpFwYDU5f3rSGIm6w+pF8spYecbWRCIJy8dCdg6/V8Retn24RXwFGDbe//6g/LB 2LRoedpyxBflza/88IcUzDHx9lzTgfH2/ycNi91r7az30JK3NWPpwoM7wC/VFXHVT/6S Aod4tEVkYrSw4kmzIIoZiHOzRECxHpustZ+mHYv2OKj5CBLcP4UNQJOZLpd0bbUsd4sC 4W1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mahJTp06HPHqdZLO7HoqnJn70jmcNWgtVnqEZw5yr3s=; b=f4H522lPMsRRF8oMjpB27BI1AIko+EtfZ4vH1y0kodB63Htj9oUDzMJcBc9PWoxoXy dwN0vKRPf7IbriAJYXxyPDVLn94eT6KxSsLnabuNt7pTtDrV2defsnWyX4JZb+M3H669 4/TUd8DcXD7U24GvJf7najMUDtdCvXlmGhuu6PTWiID7L3fwAg5RrMNju4HyXEAYRrvz WgxU36GT52zOPwbbtAd/9kWdmuF93aOxqIcocszVSrYN2XMgS+z77CQSiGauhTGDTurA fRSQ4dp09PLDFmxZEE8vQ0VfIUU5fnOXJQgiKEY6I6LvttEBV/7iwPi+3u4R3Zhz0nXs VpXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VhjecIEX; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si5845791ejb.444.2020.09.05.06.53.44; Sat, 05 Sep 2020 06:54:08 -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=@gmail.com header.s=20161025 header.b=VhjecIEX; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728627AbgIENut (ORCPT + 99 others); Sat, 5 Sep 2020 09:50:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728628AbgIENh3 (ORCPT ); Sat, 5 Sep 2020 09:37:29 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65E00C061251; Sat, 5 Sep 2020 06:37:21 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id m15so1310850pls.8; Sat, 05 Sep 2020 06:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mahJTp06HPHqdZLO7HoqnJn70jmcNWgtVnqEZw5yr3s=; b=VhjecIEXaQvS+vhxDXKUIVBlO6x0YQ3CrZTchbxRcDkhun9fUOe3XqBA08nMwU2v7j zb9Q7AbFosOHMZuuDNxoAkdHToI9+oXlbyVIcVKS0FI3rw7N1rRPHDHudAYIiMB1tJ/o LmD+0Hd96sW2mlnjnAZzDe2RWy43lRW27vUuRQKpjiGl4A9Osww8vzqdiMPQ5cCqF0m3 /97l/9bQ5LQv8dqA1EBRd1mLPeq0Q3KdjASBccKYHQbn2lvefSdshEn1ZRzgHno8XiD0 K9P3CuxNZ/N8rz8C3b3VYPeCLXhomtvzpm8KSVs+TlFwr2TbKM1TyadBwg3YSMRjlJIO 3+JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mahJTp06HPHqdZLO7HoqnJn70jmcNWgtVnqEZw5yr3s=; b=XF2r8WLLQ8eSm/Qbo2F7/M4SGgAelw59+8hTFhQ+oxxwjucSqYyrLIMj6bQxxBAZaW xg/vglIeFznoIh8YH6KW+0NXA47kCBVlxLQUkWSTZTqY08tw5vd9qSMbxxP8D7ja550m 1NHDbCYZwe0wgyXwSe2NJf8hGtfvwAYiEn44nwsGxFKpq//M2OSqMcF54e4w+vjm8r9I RENj1FN/03t7Ef5u7oWxGRng1MUYyhP1GQID3YDYiaLqVNBYzNACTvXueBIeEFidzftQ v5GDDkCXEJSJEpO4rnOWzlUbJgOhnqsl5IcVrq4FFbFBHti+hJ7Yc3QWJkA5hxzuJ69y pHlQ== X-Gm-Message-State: AOAM532nf3luYb4hFhBmq414eigr+9T9cBgw1LRRHQrO5jhwoAtm6Jxm 7cf4o4BdZP1iQaPvtQKVRzVYpMNdZ8E= X-Received: by 2002:a17:90a:e512:: with SMTP id t18mr12627322pjy.141.1599313035271; Sat, 05 Sep 2020 06:37:15 -0700 (PDT) Received: from sol.lan (106-69-184-100.dyn.iinet.net.au. [106.69.184.100]) by smtp.gmail.com with ESMTPSA id u3sm7556717pjn.29.2020.09.05.06.37.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Sep 2020 06:37:14 -0700 (PDT) From: Kent Gibson To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, bgolaszewski@baylibre.com, linus.walleij@linaro.org Cc: Kent Gibson Subject: [PATCH v7 05/20] gpiolib: make cdev a build option Date: Sat, 5 Sep 2020 21:35:34 +0800 Message-Id: <20200905133549.24606-6-warthog618@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200905133549.24606-1-warthog618@gmail.com> References: <20200905133549.24606-1-warthog618@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 17 +++++++++++++++-- drivers/gpio/Makefile | 2 +- drivers/gpio/gpiolib-cdev.h | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 5cfdaf3b004d..e4debd66d71f 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -66,8 +66,21 @@ 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 + prompt "Character device (/dev/gpiochipN) support" if EXPERT + 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 if 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 4f9abff4f2dc..7c24c8d77068 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.28.0