[PATCH 3/5] iio: proximity: hx9023s: support firmware-name property

Yasin Lee posted 5 patches 1 day, 23 hours ago
[PATCH 3/5] iio: proximity: hx9023s: support firmware-name property
Posted by Yasin Lee 1 day, 23 hours ago
Add an optional firmware-name property to specify the firmware file.
If not provided, the driver falls back to the default firmware name.

Signed-off-by: Yasin Lee <yasin.lee.x@gmail.com>
---
 drivers/iio/proximity/hx9023s.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
index eb4902d18d74..b680b89956bd 100644
--- a/drivers/iio/proximity/hx9023s.c
+++ b/drivers/iio/proximity/hx9023s.c
@@ -1089,6 +1089,7 @@ static int hx9023s_probe(struct i2c_client *client)
 	struct device *dev = &client->dev;
 	struct iio_dev *indio_dev;
 	struct hx9023s_data *data;
+	const char *fw_name = "hx9023s.bin";
 	int ret;
 
 	indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
@@ -1111,6 +1112,10 @@ static int hx9023s_probe(struct i2c_client *client)
 	if (ret)
 		return dev_err_probe(dev, ret, "regulator get failed\n");
 
+	ret = device_property_read_string(dev, "firmware-name", &fw_name);
+	if (ret && ret != -EINVAL)
+		return dev_err_probe(dev, ret, "failed to read firmware-name\n");
+
 	ret = hx9023s_id_check(indio_dev);
 	if (ret)
 		return dev_err_probe(dev, ret, "id check failed\n");
@@ -1126,7 +1131,7 @@ static int hx9023s_probe(struct i2c_client *client)
 	if (ret)
 		return dev_err_probe(dev, ret, "channel config failed\n");
 
-	ret = request_firmware_nowait(THIS_MODULE, true, "hx9023s.bin", dev,
+	ret = request_firmware_nowait(THIS_MODULE, true, fw_name, dev,
 				      GFP_KERNEL, data, hx9023s_cfg_update);
 	if (ret)
 		return dev_err_probe(dev, ret, "reg config failed\n");

-- 
2.43.0
Re: [PATCH 3/5] iio: proximity: hx9023s: support firmware-name property
Posted by Andy Shevchenko 1 day, 18 hours ago
On Mon, Feb 09, 2026 at 11:37:04AM +0800, Yasin Lee wrote:
> Add an optional firmware-name property to specify the firmware file.
> If not provided, the driver falls back to the default firmware name.

...

>  	struct device *dev = &client->dev;
>  	struct iio_dev *indio_dev;
>  	struct hx9023s_data *data;

> +	const char *fw_name = "hx9023s.bin";

Preserve reversed xmas tree order.
And looking at the usage, please split the definition and assignment.

>  	int ret;

...

> +	ret = device_property_read_string(dev, "firmware-name", &fw_name);
> +	if (ret && ret != -EINVAL)

Why is this special error code check?

> +		return dev_err_probe(dev, ret, "failed to read firmware-name\n");

	fw_name = "...";
	device_property_read_string(dev, "firmware-name", &fw_name);

I believe if wondering one can get a debug information from
request_firmware_nowait() on what firmware file has been actually used.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH 3/5] iio: proximity: hx9023s: support firmware-name property
Posted by Yasin Lee 10 hours ago
On Mon, Feb 9, 2026 at 4:50 PM Andy Shevchenko
<andriy.shevchenko@intel.com> wrote:
>
> On Mon, Feb 09, 2026 at 11:37:04AM +0800, Yasin Lee wrote:
> > Add an optional firmware-name property to specify the firmware file.
> > If not provided, the driver falls back to the default firmware name.
>
> ...
>
> >       struct device *dev = &client->dev;
> >       struct iio_dev *indio_dev;
> >       struct hx9023s_data *data;
>
> > +     const char *fw_name = "hx9023s.bin";
>
> Preserve reversed xmas tree order.
> And looking at the usage, please split the definition and assignment.
>
Ack. Will fix this in v2.

> >       int ret;
>
> ...
>
> > +     ret = device_property_read_string(dev, "firmware-name", &fw_name);
> > +     if (ret && ret != -EINVAL)
>
> Why is this special error code check?
>
Good point. I will simplify the logic as you suggested and remove the
redundant check.

> > +             return dev_err_probe(dev, ret, "failed to read firmware-name\n");
>
>         fw_name = "...";
>         device_property_read_string(dev, "firmware-name", &fw_name);
>
> I believe if wondering one can get a debug information from
> request_firmware_nowait() on what firmware file has been actually used.
>
Agreed. Thanks.

> --
> With Best Regards,
> Andy Shevchenko
>
>
Re: [PATCH 3/5] iio: proximity: hx9023s: support firmware-name property
Posted by Krzysztof Kozlowski 1 day, 19 hours ago
On Mon, Feb 09, 2026 at 11:37:04AM +0800, Yasin Lee wrote:
> Add an optional firmware-name property to specify the firmware file.
> If not provided, the driver falls back to the default firmware name.
> 
> Signed-off-by: Yasin Lee <yasin.lee.x@gmail.com>
> ---
>  drivers/iio/proximity/hx9023s.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
> index eb4902d18d74..b680b89956bd 100644
> --- a/drivers/iio/proximity/hx9023s.c
> +++ b/drivers/iio/proximity/hx9023s.c
> @@ -1089,6 +1089,7 @@ static int hx9023s_probe(struct i2c_client *client)
>  	struct device *dev = &client->dev;
>  	struct iio_dev *indio_dev;
>  	struct hx9023s_data *data;
> +	const char *fw_name = "hx9023s.bin";
>  	int ret;
>  
>  	indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
> @@ -1111,6 +1112,10 @@ static int hx9023s_probe(struct i2c_client *client)
>  	if (ret)
>  		return dev_err_probe(dev, ret, "regulator get failed\n");
>  
> +	ret = device_property_read_string(dev, "firmware-name", &fw_name);

Incorrect order of patches, see submitting patches in DT dir about the
order - documentation always comes first. This is here an undocumented ABI.

Best regards,
Krzysztof
Re: [PATCH 3/5] iio: proximity: hx9023s: support firmware-name property
Posted by Yasin Lee 11 hours ago
On Mon, Feb 9, 2026 at 4:02 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On Mon, Feb 09, 2026 at 11:37:04AM +0800, Yasin Lee wrote:
> > Add an optional firmware-name property to specify the firmware file.
> > If not provided, the driver falls back to the default firmware name.
> >
> > Signed-off-by: Yasin Lee <yasin.lee.x@gmail.com>
> > ---
> >  drivers/iio/proximity/hx9023s.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
> > index eb4902d18d74..b680b89956bd 100644
> > --- a/drivers/iio/proximity/hx9023s.c
> > +++ b/drivers/iio/proximity/hx9023s.c
> > @@ -1089,6 +1089,7 @@ static int hx9023s_probe(struct i2c_client *client)
> >       struct device *dev = &client->dev;
> >       struct iio_dev *indio_dev;
> >       struct hx9023s_data *data;
> > +     const char *fw_name = "hx9023s.bin";
> >       int ret;
> >
> >       indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
> > @@ -1111,6 +1112,10 @@ static int hx9023s_probe(struct i2c_client *client)
> >       if (ret)
> >               return dev_err_probe(dev, ret, "regulator get failed\n");
> >
> > +     ret = device_property_read_string(dev, "firmware-name", &fw_name);
>
> Incorrect order of patches, see submitting patches in DT dir about the
> order - documentation always comes first. This is here an undocumented ABI.
>
> Best regards,
> Krzysztof
>
Hi Krzysztof,
You're absolutely right, my apologies. I'll resend the series with the
correct order.

Best regards,
Yasin