clarifying i2c_get_chip_for_busnum()
Quentin Schulz
quentin.schulz at cherry.de
Tue Aug 20 13:51:47 CEST 2024
Hi,
On 8/20/24 11:12 AM, Sahaj Sarup wrote:
> [You don't often get email from sahaj.sarup at linaro.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Hi,
>
> In `include/i2c.h` , the udevice pointer and return value definition
> seems to be confusing.
>
> ```
> /**
> * i2c_get_chip_for_busnum() - get a device to use to access a chip on
> .
> .
> .
> * @devp: Returns pointer to new device if found or -ENODEV if not
> * found
> */
> ```
>
> Should this instead be:
>
> ```
> * @devp: Returns pointer to new device or NULL if not found
> * Return: 0 on success, -ENODEV on failure
> ```
>
For the @devp part, seems like it as uclass_get_device_by_seq sets it to
NULL and i2c_get_chip only modifies it when a device is found.
For the return part... not sure. We don't overwrite the return value we
get from functions we call, so not sure we can guarantee that only
ENODEV will be returned?
Cheers,
Quentin
More information about the U-Boot
mailing list