Re: [PATCH leds v5 02/12] leds: turris-omnia: Use command execution functions from the MCU driver

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

 



On Mon, Nov 04, 2024 at 03:19:14PM +0100, Marek Behún wrote:
> Use the MCU command execution functions from the MCU driver instead of
> the ad-hoc implementation in the LED driver. This allows as to drop the
> LED driver implementation, which is a duplicate.

...

> +static int omnia_match_mcu_client(struct device *dev, void *data)
> +{
> +	struct i2c_client *client;
> +
> +	client = i2c_verify_client(dev);
> +	if (!client)
> +		return 0;
> +
> +	return client->addr == OMNIA_MCU_I2C_ADDR;
> +}
> +
> +static int omnia_find_mcu_and_get_features(struct device *dev)
> +{
> +	struct device *mcu_dev;
> +	int ret;
> +
> +	mcu_dev = device_find_child(dev->parent, NULL, omnia_match_mcu_client);
> +	if (!mcu_dev)
> +		return -ENODEV;
> +
> +	ret = omnia_mcu_get_features(i2c_verify_client(mcu_dev));
> +
> +	put_device(mcu_dev);
> +
> +	return ret;
>  }

I'm wondering why the MCU driver (and node) is not represented as syscon
(with some regmap beneath it).

In such a case it would be something like

  foo = syscon_regmap_lookup_by_compatible();

here instead of all these dances.

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux