lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <jlhn73mol2g65mnbfya7w4ejtkddkkus4miii6js44x7rni2x4@54tm5dblenk4>
Date: Mon, 11 Aug 2025 15:12:27 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Bartosz Golaszewski <brgl@...ev.pl>, 
	Linus Walleij <linus.walleij@...aro.org>, linux-gpio@...r.kernel.org, Daniel Mack <daniel@...que.org>, 
	Haojian Zhuang <haojian.zhuang@...il.com>, Robert Jarzmik <robert.jarzmik@...e.fr>, 
	Russell King <linux@...linux.org.uk>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	Arnd Bergmann <arnd@...db.de>, Thomas Gleixner <tglx@...utronix.de>, 
	Ingo Molnar <mingo@...nel.org>, Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, 
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH 19/21] usb: udc: pxa: remove unused platform_data

On Fri, Aug 08, 2025 at 05:18:04PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> None of the remaining boards put useful data into the platform_data
> structures, so effectively this only works with DT based probing.
> 
> Remove all code that references this data, to stop using the legacy
> gpiolib interfaces. The pxa27x version already supports gpio
> descriptors, while the pxa25x version now does it the same way.
> 
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  arch/arm/mach-pxa/devices.c              |  7 ----
>  arch/arm/mach-pxa/gumstix.c              |  1 -
>  arch/arm/mach-pxa/udc.h                  |  8 -----
>  drivers/usb/gadget/udc/pxa25x_udc.c      | 41 ++++++++----------------
>  drivers/usb/gadget/udc/pxa25x_udc.h      |  2 +-
>  drivers/usb/gadget/udc/pxa27x_udc.c      | 35 +++-----------------
>  drivers/usb/gadget/udc/pxa27x_udc.h      |  2 --
>  include/linux/platform_data/pxa2xx_udc.h | 15 ---------
>  8 files changed, 19 insertions(+), 92 deletions(-)
>  delete mode 100644 arch/arm/mach-pxa/udc.h
> 
> diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
> index 7695cfce01a1..edad956a1483 100644
> --- a/arch/arm/mach-pxa/devices.c
> +++ b/arch/arm/mach-pxa/devices.c
> @@ -11,7 +11,6 @@
>  #include <linux/platform_data/i2c-pxa.h>
>  #include <linux/soc/pxa/cpu.h>
>  
> -#include "udc.h"
>  #include <linux/platform_data/video-pxafb.h>
>  #include <linux/platform_data/mmc-pxamci.h>
>  #include "irqs.h"
> @@ -83,10 +82,6 @@ void __init pxa_set_mci_info(const struct pxamci_platform_data *info,
>  		pr_err("Unable to create mci device: %d\n", err);
>  }
>  
> -static struct pxa2xx_udc_mach_info pxa_udc_info = {
> -	.gpio_pullup = -1,
> -};
> -
>  static struct resource pxa2xx_udc_resources[] = {
>  	[0] = {
>  		.start	= 0x40600000,
> @@ -108,7 +103,6 @@ struct platform_device pxa25x_device_udc = {
>  	.resource	= pxa2xx_udc_resources,
>  	.num_resources	= ARRAY_SIZE(pxa2xx_udc_resources),
>  	.dev		=  {
> -		.platform_data	= &pxa_udc_info,
>  		.dma_mask	= &udc_dma_mask,
>  	}
>  };
> @@ -119,7 +113,6 @@ struct platform_device pxa27x_device_udc = {
>  	.resource	= pxa2xx_udc_resources,
>  	.num_resources	= ARRAY_SIZE(pxa2xx_udc_resources),
>  	.dev		=  {
> -		.platform_data	= &pxa_udc_info,
>  		.dma_mask	= &udc_dma_mask,
>  	}
>  };
> diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
> index 1713bdf3b71e..6074815a4bca 100644
> --- a/arch/arm/mach-pxa/gumstix.c
> +++ b/arch/arm/mach-pxa/gumstix.c
> @@ -39,7 +39,6 @@
>  
>  #include "pxa25x.h"
>  #include <linux/platform_data/mmc-pxamci.h>
> -#include "udc.h"
>  #include "gumstix.h"
>  #include "devices.h"
>  
> diff --git a/arch/arm/mach-pxa/udc.h b/arch/arm/mach-pxa/udc.h
> deleted file mode 100644
> index 9a827e32db98..000000000000
> --- a/arch/arm/mach-pxa/udc.h
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -/*
> - * arch/arm/mach-pxa/include/mach/udc.h
> - *
> - */
> -#include <linux/platform_data/pxa2xx_udc.h>
> -
> -extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
> -
> diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
> index b97fb7b0cb2c..bad151aedec1 100644
> --- a/drivers/usb/gadget/udc/pxa25x_udc.c
> +++ b/drivers/usb/gadget/udc/pxa25x_udc.c
> @@ -12,7 +12,7 @@
>  /* #define VERBOSE_DEBUG */
>  
>  #include <linux/device.h>
> -#include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>
>  #include <linux/module.h>
>  #include <linux/kernel.h>
>  #include <linux/ioport.h>
> @@ -261,24 +261,12 @@ static void nuke (struct pxa25x_ep *, int status);
>  /* one GPIO should control a D+ pullup, so host sees this device (or not) */
>  static void pullup_off(void)
>  {
> -	struct pxa2xx_udc_mach_info		*mach = the_controller->mach;
> -	int off_level = mach->gpio_pullup_inverted;
> -
> -	if (gpio_is_valid(mach->gpio_pullup))
> -		gpio_set_value(mach->gpio_pullup, off_level);
> -	else if (mach->udc_command)
> -		mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
> +	gpiod_set_value(the_controller->pullup_gpio, 0);
>  }
>  
>  static void pullup_on(void)
>  {
> -	struct pxa2xx_udc_mach_info		*mach = the_controller->mach;
> -	int on_level = !mach->gpio_pullup_inverted;
> -
> -	if (gpio_is_valid(mach->gpio_pullup))
> -		gpio_set_value(mach->gpio_pullup, on_level);
> -	else if (mach->udc_command)
> -		mach->udc_command(PXA2XX_UDC_CMD_CONNECT);
> +	gpiod_set_value(the_controller->pullup_gpio, 1);
>  }
>  
>  #if defined(CONFIG_CPU_BIG_ENDIAN)
> @@ -1190,8 +1178,7 @@ static int pxa25x_udc_pullup(struct usb_gadget *_gadget, int is_active)
>  
>  	udc = container_of(_gadget, struct pxa25x_udc, gadget);
>  
> -	/* not all boards support pullup control */
> -	if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command)
> +	if (!udc->pullup_gpio)
>  		return -EOPNOTSUPP;
>  
>  	udc->pullup = (is_active != 0);
> @@ -2343,19 +2330,17 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
>  
>  	/* other non-static parts of init */
>  	dev->dev = &pdev->dev;
> -	dev->mach = dev_get_platdata(&pdev->dev);
>  
>  	dev->transceiver = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
>  
> -	if (gpio_is_valid(dev->mach->gpio_pullup)) {
> -		retval = devm_gpio_request_one(&pdev->dev, dev->mach->gpio_pullup,
> -					       GPIOF_OUT_INIT_LOW, "pca25x_udc GPIO PULLUP");
> -		if (retval) {
> -			dev_dbg(&pdev->dev,
> -				"can't get pullup gpio %d, err: %d\n",
> -				dev->mach->gpio_pullup, retval);
> -			goto err;
> -		}
> +	dev->pullup_gpio = devm_gpiod_get_index_optional(&pdev->dev, "pullup", 0,
> +						    GPIOD_OUT_LOW);

I think this should be GPIOD_OUT_HIGH: you want this to be active and
GPIO is likely "active low".

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ