Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7771087rwb; Wed, 23 Nov 2022 10:29:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf6XhmrbloFa/xJ+98adl1rvSbz6HpuR7nfI7sEyMaaN/JRt+S5XvH2yOvrDpYkFn5c/lpnm X-Received: by 2002:a17:903:41c8:b0:188:f0d7:ffbe with SMTP id u8-20020a17090341c800b00188f0d7ffbemr9969534ple.27.1669228169762; Wed, 23 Nov 2022 10:29:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669228169; cv=none; d=google.com; s=arc-20160816; b=jpskmZ6BOpDfeLGsM4KTR5OyROp8fxBF6e1MpWcx1xifRtmRuGQWEoYwl7lcTaehvC 1vSIXc+P4ZIwtQUAROAIAxh1q6z9kL7ei37WVTa7xUwDrEsL972L7BXgN9I5yvyaEUc6 rjUMYkkRtIRFPCjQdGvoVlQpnv7V9wHGyRnx6bBVqlVIA2XegDyTZur2+NA3BEOBdIlp MV6v6fuSEzVi+SKJDynEtdA1TgjFkVR3BJDowjoe9Wxu6kVZSJMmZruQidY751eTAeJI Uwu2FcRNESu08QvryJRi5ec9ka3oyZkgku5FuWiutIX/Ty38urlLWC6pHhfrPNKuL2fm yzFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5TixmNtSySPsckggzW7Ij7vXuN0IJr1J+2UHIH/9ifE=; b=YaxpE7VBKT3FXzkoeYLnIJBqhYBuKABS2SOXGmvJFaa7t0U54I5GePLuE1Bgl3Y/Xf rYfZlmYIOkk960z5pgggzqC+bzag2i2X4VqwyqW0CckeHASkif3EAEYePvlFBIGA8FdV l28OcM7H1jw0DIkk4JxYgPvz/nZ7sMX/aD29hefhLApP46vJT/3LlO9w0GRp520j0v3O 3JCfiEEFyhxLrraGNRC2YrzzzAo+cE3DF+4Rhb95Mfpl2GJuAwpuadFkrY2kgGvo4uQt v/Jbc3FbtHXR97Of80XhrQ/eCkuGo4J5AZsec0Ye9dWW358tWaJpKU3dAitZDIUM/gKV oFdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fH1IDrFw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w189-20020a6382c6000000b004776766023csi9514088pgd.609.2022.11.23.10.29.15; Wed, 23 Nov 2022 10:29:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fH1IDrFw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239160AbiKWRcb (ORCPT + 88 others); Wed, 23 Nov 2022 12:32:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238547AbiKWRcC (ORCPT ); Wed, 23 Nov 2022 12:32:02 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D566C8CFDC; Wed, 23 Nov 2022 09:31:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669224714; x=1700760714; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=cxDtgEHZHpyKDGMJo8zqaKGeHHJYjWhn770PIRuGDRs=; b=fH1IDrFwWJ7AR/qvXV/4RHJ6AsFKcUV2OnHGLuenB4oWJeoejcPIUHhM gH6U6hB6jvOhtKrDi8ORCUojM4cY051OmzpWtM7WCIb5/wu9BkNODa6G7 pbGUY//LGBq1KYs2WrUBfpA4dCcPF2L0aFvGz7AAUq7uHAzSeg7PtPduy ZLb9ln2DF/+HvvtmS78XYOSljOAQLb+gpAw7OYA0i82zIEr/97ewGqUDt coToX8v6w34AYNcALcljkpe76WA/hPwrbR8R6Ac7nzNx59/X7U2zom3/E Qk3GOgV/hhHvmEdo026+rlE/yDgefAGQ5WgW35lzVPVNr9fe9KGLPnFdm Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="314156156" X-IronPort-AV: E=Sophos;i="5.96,187,1665471600"; d="scan'208";a="314156156" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2022 09:31:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="619698160" X-IronPort-AV: E=Sophos;i="5.96,187,1665471600"; d="scan'208";a="619698160" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga006.jf.intel.com with ESMTP; 23 Nov 2022 09:31:51 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1oxtbC-00GNpi-0F; Wed, 23 Nov 2022 19:31:50 +0200 Date: Wed, 23 Nov 2022 19:31:49 +0200 From: Andy Shevchenko To: William Breathitt Gray Cc: linus.walleij@linaro.org, brgl@bgdev.pl, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, michael@walle.cc, broonie@kernel.org Subject: Re: [PATCH v3 9/9] gpio: i8255: Remove unused legacy interface Message-ID: References: <79a900a3ae31882f1186aa37ebe895b84916e98e.1669100542.git.william.gray@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <79a900a3ae31882f1186aa37ebe895b84916e98e.1669100542.git.william.gray@linaro.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 22, 2022 at 02:11:06AM -0500, William Breathitt Gray wrote: > All i8255 library consumers have migrated to the new interface > leveraging the gpio-regmap API. Legacy interface functions and code are > removed as no longer needed. Reviewed-by: Andy Shevchenko > Suggested-by: Andy Shevchenko > Signed-off-by: William Breathitt Gray > --- > drivers/gpio/gpio-i8255.c | 243 +------------------------------------- > drivers/gpio/gpio-i8255.h | 39 ------ > 2 files changed, 1 insertion(+), 281 deletions(-) > > diff --git a/drivers/gpio/gpio-i8255.c b/drivers/gpio/gpio-i8255.c > index 9ecb2e9b97f9..64ab80fc4a1e 100644 > --- a/drivers/gpio/gpio-i8255.c > +++ b/drivers/gpio/gpio-i8255.c > @@ -3,16 +3,13 @@ > * Intel 8255 Programmable Peripheral Interface > * Copyright (C) 2022 William Breathitt Gray > */ > -#include > +#include > #include > #include > #include > #include > -#include > #include > #include > -#include > -#include > > #include "gpio-i8255.h" > > @@ -30,15 +27,6 @@ > #define I8255_REG_DAT_BASE I8255_PORTA > #define I8255_REG_DIR_IN_BASE I8255_CONTROL > > -static int i8255_get_port(struct i8255 __iomem *const ppi, > - const unsigned long io_port, const unsigned long mask) > -{ > - const unsigned long bank = io_port / 3; > - const unsigned long ppi_port = io_port % 3; > - > - return ioread8(&ppi[bank].port[ppi_port]) & mask; > -} > - > static int i8255_direction_mask(const unsigned int offset) > { > const unsigned int stride = offset / I8255_NGPIO_PER_REG; > @@ -103,235 +91,6 @@ static int i8255_reg_mask_xlate(struct gpio_regmap *gpio, unsigned int base, > } > } > > -static void i8255_set_port(struct i8255 __iomem *const ppi, > - struct i8255_state *const state, > - const unsigned long io_port, > - const unsigned long mask, const unsigned long bits) > -{ > - const unsigned long bank = io_port / 3; > - const unsigned long ppi_port = io_port % 3; > - unsigned long flags; > - unsigned long out_state; > - > - spin_lock_irqsave(&state[bank].lock, flags); > - > - out_state = ioread8(&ppi[bank].port[ppi_port]); > - out_state = (out_state & ~mask) | (bits & mask); > - iowrite8(out_state, &ppi[bank].port[ppi_port]); > - > - spin_unlock_irqrestore(&state[bank].lock, flags); > -} > - > -/** > - * i8255_direction_input - configure signal offset as input > - * @ppi: Intel 8255 Programmable Peripheral Interface banks > - * @state: devices states of the respective PPI banks > - * @offset: signal offset to configure as input > - * > - * Configures a signal @offset as input for the respective Intel 8255 > - * Programmable Peripheral Interface (@ppi) banks. The @state control_state > - * values are updated to reflect the new configuration. > - */ > -void i8255_direction_input(struct i8255 __iomem *const ppi, > - struct i8255_state *const state, > - const unsigned long offset) > -{ > - const unsigned long io_port = offset / 8; > - const unsigned long bank = io_port / 3; > - unsigned long flags; > - > - spin_lock_irqsave(&state[bank].lock, flags); > - > - state[bank].control_state |= I8255_CONTROL_MODE_SET; > - state[bank].control_state |= i8255_direction_mask(offset % 24); > - > - iowrite8(state[bank].control_state, &ppi[bank].control); > - > - spin_unlock_irqrestore(&state[bank].lock, flags); > -} > -EXPORT_SYMBOL_NS_GPL(i8255_direction_input, I8255); > - > -/** > - * i8255_direction_output - configure signal offset as output > - * @ppi: Intel 8255 Programmable Peripheral Interface banks > - * @state: devices states of the respective PPI banks > - * @offset: signal offset to configure as output > - * @value: signal value to output > - * > - * Configures a signal @offset as output for the respective Intel 8255 > - * Programmable Peripheral Interface (@ppi) banks and sets the respective signal > - * output to the desired @value. The @state control_state values are updated to > - * reflect the new configuration. > - */ > -void i8255_direction_output(struct i8255 __iomem *const ppi, > - struct i8255_state *const state, > - const unsigned long offset, > - const unsigned long value) > -{ > - const unsigned long io_port = offset / 8; > - const unsigned long bank = io_port / 3; > - unsigned long flags; > - > - spin_lock_irqsave(&state[bank].lock, flags); > - > - state[bank].control_state |= I8255_CONTROL_MODE_SET; > - state[bank].control_state &= ~i8255_direction_mask(offset % 24); > - > - iowrite8(state[bank].control_state, &ppi[bank].control); > - > - spin_unlock_irqrestore(&state[bank].lock, flags); > - > - i8255_set(ppi, state, offset, value); > -} > -EXPORT_SYMBOL_NS_GPL(i8255_direction_output, I8255); > - > -/** > - * i8255_get - get signal value at signal offset > - * @ppi: Intel 8255 Programmable Peripheral Interface banks > - * @offset: offset of signal to get > - * > - * Returns the signal value (0=low, 1=high) for the signal at @offset for the > - * respective Intel 8255 Programmable Peripheral Interface (@ppi) banks. > - */ > -int i8255_get(struct i8255 __iomem *const ppi, const unsigned long offset) > -{ > - const unsigned long io_port = offset / 8; > - const unsigned long offset_mask = BIT(offset % 8); > - > - return !!i8255_get_port(ppi, io_port, offset_mask); > -} > -EXPORT_SYMBOL_NS_GPL(i8255_get, I8255); > - > -/** > - * i8255_get_direction - get the I/O direction for a signal offset > - * @state: devices states of the respective PPI banks > - * @offset: offset of signal to get direction > - * > - * Returns the signal direction (0=output, 1=input) for the signal at @offset. > - */ > -int i8255_get_direction(const struct i8255_state *const state, > - const unsigned long offset) > -{ > - const unsigned long io_port = offset / 8; > - const unsigned long bank = io_port / 3; > - > - return !!(state[bank].control_state & i8255_direction_mask(offset % 24)); > -} > -EXPORT_SYMBOL_NS_GPL(i8255_get_direction, I8255); > - > -/** > - * i8255_get_multiple - get multiple signal values at multiple signal offsets > - * @ppi: Intel 8255 Programmable Peripheral Interface banks > - * @mask: mask of signals to get > - * @bits: bitmap to store signal values > - * @ngpio: number of GPIO signals of the respective PPI banks > - * > - * Stores in @bits the values (0=low, 1=high) for the signals defined by @mask > - * for the respective Intel 8255 Programmable Peripheral Interface (@ppi) banks. > - */ > -void i8255_get_multiple(struct i8255 __iomem *const ppi, > - const unsigned long *const mask, > - unsigned long *const bits, const unsigned long ngpio) > -{ > - unsigned long offset; > - unsigned long port_mask; > - unsigned long io_port; > - unsigned long port_state; > - > - bitmap_zero(bits, ngpio); > - > - for_each_set_clump8(offset, port_mask, mask, ngpio) { > - io_port = offset / 8; > - port_state = i8255_get_port(ppi, io_port, port_mask); > - > - bitmap_set_value8(bits, port_state, offset); > - } > -} > -EXPORT_SYMBOL_NS_GPL(i8255_get_multiple, I8255); > - > -/** > - * i8255_mode0_output - configure all PPI ports to MODE 0 output mode > - * @ppi: Intel 8255 Programmable Peripheral Interface bank > - * > - * Configures all Intel 8255 Programmable Peripheral Interface (@ppi) ports to > - * MODE 0 (Basic Input/Output) output mode. > - */ > -void i8255_mode0_output(struct i8255 __iomem *const ppi) > -{ > - iowrite8(I8255_CONTROL_MODE_SET, &ppi->control); > -} > -EXPORT_SYMBOL_NS_GPL(i8255_mode0_output, I8255); > - > -/** > - * i8255_set - set signal value at signal offset > - * @ppi: Intel 8255 Programmable Peripheral Interface banks > - * @state: devices states of the respective PPI banks > - * @offset: offset of signal to set > - * @value: value of signal to set > - * > - * Assigns output @value for the signal at @offset for the respective Intel 8255 > - * Programmable Peripheral Interface (@ppi) banks. > - */ > -void i8255_set(struct i8255 __iomem *const ppi, struct i8255_state *const state, > - const unsigned long offset, const unsigned long value) > -{ > - const unsigned long io_port = offset / 8; > - const unsigned long port_offset = offset % 8; > - const unsigned long mask = BIT(port_offset); > - const unsigned long bits = value << port_offset; > - > - i8255_set_port(ppi, state, io_port, mask, bits); > -} > -EXPORT_SYMBOL_NS_GPL(i8255_set, I8255); > - > -/** > - * i8255_set_multiple - set signal values at multiple signal offsets > - * @ppi: Intel 8255 Programmable Peripheral Interface banks > - * @state: devices states of the respective PPI banks > - * @mask: mask of signals to set > - * @bits: bitmap of signal output values > - * @ngpio: number of GPIO signals of the respective PPI banks > - * > - * Assigns output values defined by @bits for the signals defined by @mask for > - * the respective Intel 8255 Programmable Peripheral Interface (@ppi) banks. > - */ > -void i8255_set_multiple(struct i8255 __iomem *const ppi, > - struct i8255_state *const state, > - const unsigned long *const mask, > - const unsigned long *const bits, > - const unsigned long ngpio) > -{ > - unsigned long offset; > - unsigned long port_mask; > - unsigned long io_port; > - unsigned long value; > - > - for_each_set_clump8(offset, port_mask, mask, ngpio) { > - io_port = offset / 8; > - value = bitmap_get_value8(bits, offset); > - i8255_set_port(ppi, state, io_port, port_mask, value); > - } > -} > -EXPORT_SYMBOL_NS_GPL(i8255_set_multiple, I8255); > - > -/** > - * i8255_state_init - initialize i8255_state structure > - * @state: devices states of the respective PPI banks > - * @nbanks: number of Intel 8255 Programmable Peripheral Interface banks > - * > - * Initializes the @state of each Intel 8255 Programmable Peripheral Interface > - * bank for use in i8255 library functions. > - */ > -void i8255_state_init(struct i8255_state *const state, > - const unsigned long nbanks) > -{ > - unsigned long bank; > - > - for (bank = 0; bank < nbanks; bank++) > - spin_lock_init(&state[bank].lock); > -} > -EXPORT_SYMBOL_NS_GPL(i8255_state_init, I8255); > - > /** > * devm_i8255_regmap_register - Register an i8255 GPIO controller > * @dev: device that is registering this i8255 GPIO device > diff --git a/drivers/gpio/gpio-i8255.h b/drivers/gpio/gpio-i8255.h > index 6ec987835c14..bc3023745e7b 100644 > --- a/drivers/gpio/gpio-i8255.h > +++ b/drivers/gpio/gpio-i8255.h > @@ -6,28 +6,6 @@ > #include > #include > #include > -#include > -#include > - > -/** > - * struct i8255 - Intel 8255 register structure > - * @port: Port A, B, and C > - * @control: Control register > - */ > -struct i8255 { > - u8 port[3]; > - u8 control; > -}; > - > -/** > - * struct i8255_state - Intel 8255 state structure > - * @lock: synchronization lock for accessing device state > - * @control_state: Control register state > - */ > -struct i8255_state { > - spinlock_t lock; > - u8 control_state; > -}; > > #define i8255_volatile_regmap_range(_base) regmap_reg_range(_base, _base + 0x2) > > @@ -53,21 +31,4 @@ struct i8255_regmap_config { > int devm_i8255_regmap_register(struct device *dev, > const struct i8255_regmap_config *config); > > -void i8255_direction_input(struct i8255 __iomem *ppi, struct i8255_state *state, > - unsigned long offset); > -void i8255_direction_output(struct i8255 __iomem *ppi, > - struct i8255_state *state, unsigned long offset, > - unsigned long value); > -int i8255_get(struct i8255 __iomem *ppi, unsigned long offset); > -int i8255_get_direction(const struct i8255_state *state, unsigned long offset); > -void i8255_get_multiple(struct i8255 __iomem *ppi, const unsigned long *mask, > - unsigned long *bits, unsigned long ngpio); > -void i8255_mode0_output(struct i8255 __iomem *const ppi); > -void i8255_set(struct i8255 __iomem *ppi, struct i8255_state *state, > - unsigned long offset, unsigned long value); > -void i8255_set_multiple(struct i8255 __iomem *ppi, struct i8255_state *state, > - const unsigned long *mask, const unsigned long *bits, > - unsigned long ngpio); > -void i8255_state_init(struct i8255_state *const state, unsigned long nbanks); > - > #endif /* _I8255_H_ */ > -- > 2.38.1 > -- With Best Regards, Andy Shevchenko