[PATCH 09/12] gpio: generic: sync with upstream Linux gpio-mmio driver

Antony Pavlov antonynpavlov at gmail.com
Thu May 6 16:45:00 PDT 2021


On Tue, 27 Apr 2021 22:23:06 +0200
Ahmad Fatoum <a.fatoum at pengutronix.de> wrote:

Hi Ahmad!

> --- a/drivers/gpio/gpio-generic.c
> +++ b/drivers/gpio/gpio-generic.c
...
> @@ -337,34 +531,37 @@ static int bgpio_dev_probe(struct device_d *dev)
>  	unsigned long flags = 0;
>  	int err;
>  	struct bgpio_chip *bgc;
> +	struct bgpio_pdata *pdata;
>  
> -	r = dev_get_resource_by_name(dev, IORESOURCE_MEM, "dat");
> -	if (IS_ERR(r))
> -		return PTR_ERR(r);
> +	pdata = bgpio_parse_dt(dev, &flags);
> +	if (IS_ERR(pdata))
> +		return PTR_ERR(pdata);
> +

This patch breaks RISC-V erizo gpio, here is error message:

basic-mmio-gpio 91000000.gpio at 91000000.of: probe failed: error 22


The problem is here:

> +	r = dev_request_mem_resource_by_name(dev, "dat");
> +	if (!r)
> +		return -EINVAL;
>  
>  	sz = resource_size(r);
>  
> -	dat = bgpio_map(dev, "dat", sz, &err);
> -	if (!dat)
> -		return err ? err : -EINVAL;
> +	dat = bgpio_map(dev, "dat", sz);

the dev_request_mem_resource_by_name() function invokes request_iomem_region() (success),
but bgpio_map() invokes dev_request_mem_resource_by_name() for the same dev and name again.
This time dev_request_mem_resource_by_name() fails.



-- 
Best regards,
  Antony Pavlov



More information about the barebox mailing list