Re: [PATCH 05/10] gpiolib: export proper gpio descriptor API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Marco,

On 20.06.23 07:20, Marco Felsch wrote:
>> -static unsigned gpioinfo_chip_offset(struct gpio_desc *desc)
>> +static unsigned gpioinfo_chip_offset(const struct gpio_desc *desc)
> 
> Why do we stick with gpioinfo_* here? IMHO we could use
> gpiodesc_chip_offset() since the gpioinfo is gone.

gpioinfo_ is internal. gpiod_ is external. I thought about renaming
gpioinfo_ to gpiodesc_, but found it confusing, because they are
too similar in name.

>>  {
>>  	return (desc - gpio_desc) - desc->chip->base;
>>  }
>>  
>> -static int gpio_adjust_value(struct gpio_desc *desc,
>> +static int gpio_adjust_value(const struct gpio_desc *desc,
>>  			     int value)
>>  {
>>  	if (value < 0)
>> @@ -159,17 +189,40 @@ void gpio_free(unsigned gpio)
>>  {
>>  	struct gpio_desc *desc = gpio_to_desc(gpio);
>>  
>> +	gpioinfo_free(desc);
> 
> Same for gpioinfo_free() which could become gpiodesc_free().

See above.

>>  int gpio_direction_output(unsigned gpio, int value)
>>  {
>> @@ -252,13 +359,27 @@ int gpio_direction_output(unsigned gpio, int value)
>>  	if (ret)
>>  		return ret;
>>  
>> -	return gpioinfo_direction_output(desc, value);
>> +	return gpiod_direction_output_raw(desc, value);
>>  }
>>  EXPORT_SYMBOL(gpio_direction_output);
> 
> This function should be deleted since we don't support the global 'int'
> gpio anymore.

We do support it. Lots of code across the tree doesn't use gpiod_ API.

>>  EXPORT_SYMBOL(gpio_direction_input);
> 
> gpio_direction_input should be deleted as well?

Once we have switches all over to use gpiod_ API, we could drop it, yes.
Patches to migrate existing users are certainly welcome ;)

Cheers,
Ahmad

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux