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
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
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 > >
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
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
© 2016 - 2026 Red Hat, Inc.