Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp212627pxk; Wed, 9 Sep 2020 03:32:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx732gKuZdWj8edWA6+FNIaOxTNslCuFM0284yKxdt7xYmB3v57rUNifkL69cx08EENnuxL X-Received: by 2002:a17:906:2bdb:: with SMTP id n27mr3009790ejg.12.1599647523707; Wed, 09 Sep 2020 03:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599647523; cv=none; d=google.com; s=arc-20160816; b=xOj6aKSAit2g+T+d7wvv67lLMV2soVhj1l0gQsDhX/IH8o/HLsBqBqxWmtbtd+QVHV osaBGTsXY1MSsYC23PD3xwaAFMmmFyCEZFBuayaM+fzslpNbwKYwbJcnyw0LCSMy7tKY c1rB4FgMokEGJ+nG267yAjLTAnqgMwmmEFAIiAzPun9jM2OqquMwfea8K3xJv08yt3uS M5rPKhXgLkVjyxFehIp1tQrh91hR8iaaMknXyoXBCOF+zDuj2SkCH+P6Eg62fqxcV+UN PGP9UfDhv0DSE3dUW0lH4pr/XP07pQ8iYI3UwXcBzJRDQ4meozPtj2Cvfv6P61KJ9amV qf7Q== 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=qabEZ4MrmyL8uswE2fQbnHsGFqveM37pBPgdMeFeGnDVjMufVqmqoqRusUHsf7avjT KP6OACW4m90iYV80KT4M7iMWym67ROXDmzUKc8ES+aY9hF5A0fAkg1zFbZZfjYKuh7EB 7ZAusDyGJp1uOE3x9KKZNx8+hw62GDTon+vPpdRFEWbgRGK0SmT726h4yel4O9oVS4eB K/V5Zc9Ygw5Vk1g42FFF/mmqsIiOzMv0f0/3j/MHNsygAoPfq2zJtJzxe13DFVaaL1dh xgiVHO/0Le0BLuNd0rY4Jcp4gc2vhh/rDACoSgQcmGw/BW/lh7o8L4cx9LgByJOkwm6A tV2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aj1kqdSK; 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 a6si1284705edq.278.2020.09.09.03.31.41; Wed, 09 Sep 2020 03:32:03 -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=aj1kqdSK; 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 S1729413AbgIIK2R (ORCPT + 99 others); Wed, 9 Sep 2020 06:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728663AbgIIK1n (ORCPT ); Wed, 9 Sep 2020 06:27:43 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20EDEC061573; Wed, 9 Sep 2020 03:27:43 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id k15so1741493pfc.12; Wed, 09 Sep 2020 03:27:43 -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=aj1kqdSKGW9RlMCn/4c4Bx9FhFI9VyCQPIOIccTgs4V73dlFT0Yg8hioxJe7mQhkz6 MHQKK7wTcumJo2OYjlsxYuSwwwyy5rkfr4UAJUGW2Ha5DJtAmASjg+hTxKmzDR1lgEjr u7cE87TZZoRs6/8eijAGURONjkWpKg0oJA0RwjVIBF//b0finRtB2/BteIEFJTpLtRCC H1Ybfq/loPHBicefMiuIcLT/UJSfvThbfRRcnvrjmE9+rWHHIplAcC/36p8ezhWLSvKR sfp0tHVBhi2To/ySWV4prFD/ig3nEKNyf9k/75Ts6WFzyie4uQR7rRs+J/AGeC99mgQH n4kg== 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=h9AmDlGc7VQa+3SbsvPb4TMO0g/2gQ4Qr4yMNgyqdnJijTFISOK/6/vYvbm6is5Uu6 j6ZT6HqW3yC/uWIjSolyXdAnDZQDnUyM0UtXVMti05lDFnWaUnxtVXjvMbjmqR994D7f 9pGoMHVVLH4wwpyIoRUz61G5sVNM598dFy0pKUFHSfHtrD/xS041FxnbnFptA2aRbZcL mKSd8SmLZugPPCmLhDhsiL20p6+OS2nA9v/baG7xL+1AajBPTTVT+hfGH/N7qJ0mAWMx wdYDjonPZrHbhf6Z4utCdzzPtZTxInCxkHe7LDgDcGoCSYhoJ7gDPLIjDVDCEsUr6p3V L3gQ== X-Gm-Message-State: AOAM5307zwaMrNUsOU4v3X+Folb+95KgfwRqmk3bTdqhJojS3KtYQXxi k0WHSrvXibXH72RBlfunSjT/eh2ZJhs= X-Received: by 2002:a05:6a00:1356:b029:13e:5203:fba3 with SMTP id k22-20020a056a001356b029013e5203fba3mr299643pfu.3.1599647262251; Wed, 09 Sep 2020 03:27:42 -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 c7sm2338168pfj.100.2020.09.09.03.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 03:27:41 -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 v8 05/20] gpiolib: make cdev a build option Date: Wed, 9 Sep 2020 18:26:25 +0800 Message-Id: <20200909102640.1657622-6-warthog618@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200909102640.1657622-1-warthog618@gmail.com> References: <20200909102640.1657622-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