diff mbox series

[v1,1/1] iio: adc: xilinx-ams: Convert to use fwnode_device_is_compatible()

Message ID 20230119174749.76769-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted
Headers show
Series [v1,1/1] iio: adc: xilinx-ams: Convert to use fwnode_device_is_compatible() | expand

Commit Message

Andy Shevchenko Jan. 19, 2023, 5:47 p.m. UTC
Replace open coded fwnode_device_is_compatible() in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/adc/xilinx-ams.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Michal Simek Jan. 20, 2023, 9:11 a.m. UTC | #1
On 1/19/23 18:47, Andy Shevchenko wrote:
> 
> Replace open coded fwnode_device_is_compatible() in the driver.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/iio/adc/xilinx-ams.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
> index a507d2e17079..34cf336b3490 100644
> --- a/drivers/iio/adc/xilinx-ams.c
> +++ b/drivers/iio/adc/xilinx-ams.c
> @@ -1220,8 +1220,7 @@ static int ams_init_module(struct iio_dev *indio_dev,
>          int num_channels = 0;
>          int ret;
> 
> -       if (fwnode_property_match_string(fwnode, "compatible",
> -                                        "xlnx,zynqmp-ams-ps") == 0) {
> +       if (fwnode_device_is_compatible(fwnode, "xlnx,zynqmp-ams-ps")) {
>                  ams->ps_base = fwnode_iomap(fwnode, 0);
>                  if (!ams->ps_base)
>                          return -ENXIO;
> @@ -1232,8 +1231,7 @@ static int ams_init_module(struct iio_dev *indio_dev,
>                  /* add PS channels to iio device channels */
>                  memcpy(channels, ams_ps_channels, sizeof(ams_ps_channels));
>                  num_channels = ARRAY_SIZE(ams_ps_channels);
> -       } else if (fwnode_property_match_string(fwnode, "compatible",
> -                                               "xlnx,zynqmp-ams-pl") == 0) {
> +       } else if (fwnode_device_is_compatible(fwnode, "xlnx,zynqmp-ams-pl")) {
>                  ams->pl_base = fwnode_iomap(fwnode, 0);
>                  if (!ams->pl_base)
>                          return -ENXIO;
> @@ -1247,8 +1245,7 @@ static int ams_init_module(struct iio_dev *indio_dev,
>                  num_channels += AMS_PL_MAX_FIXED_CHANNEL;
>                  num_channels = ams_get_ext_chan(fwnode, channels,
>                                                  num_channels);
> -       } else if (fwnode_property_match_string(fwnode, "compatible",
> -                                               "xlnx,zynqmp-ams") == 0) {
> +       } else if (fwnode_device_is_compatible(fwnode, "xlnx,zynqmp-ams")) {
>                  /* add AMS channels to iio device channels */
>                  memcpy(channels, ams_ctrl_channels, sizeof(ams_ctrl_channels));
>                  num_channels += ARRAY_SIZE(ams_ctrl_channels);
> --
> 2.39.0
> 

Reviewed-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal
diff mbox series

Patch

diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
index a507d2e17079..34cf336b3490 100644
--- a/drivers/iio/adc/xilinx-ams.c
+++ b/drivers/iio/adc/xilinx-ams.c
@@ -1220,8 +1220,7 @@  static int ams_init_module(struct iio_dev *indio_dev,
 	int num_channels = 0;
 	int ret;
 
-	if (fwnode_property_match_string(fwnode, "compatible",
-					 "xlnx,zynqmp-ams-ps") == 0) {
+	if (fwnode_device_is_compatible(fwnode, "xlnx,zynqmp-ams-ps")) {
 		ams->ps_base = fwnode_iomap(fwnode, 0);
 		if (!ams->ps_base)
 			return -ENXIO;
@@ -1232,8 +1231,7 @@  static int ams_init_module(struct iio_dev *indio_dev,
 		/* add PS channels to iio device channels */
 		memcpy(channels, ams_ps_channels, sizeof(ams_ps_channels));
 		num_channels = ARRAY_SIZE(ams_ps_channels);
-	} else if (fwnode_property_match_string(fwnode, "compatible",
-						"xlnx,zynqmp-ams-pl") == 0) {
+	} else if (fwnode_device_is_compatible(fwnode, "xlnx,zynqmp-ams-pl")) {
 		ams->pl_base = fwnode_iomap(fwnode, 0);
 		if (!ams->pl_base)
 			return -ENXIO;
@@ -1247,8 +1245,7 @@  static int ams_init_module(struct iio_dev *indio_dev,
 		num_channels += AMS_PL_MAX_FIXED_CHANNEL;
 		num_channels = ams_get_ext_chan(fwnode, channels,
 						num_channels);
-	} else if (fwnode_property_match_string(fwnode, "compatible",
-						"xlnx,zynqmp-ams") == 0) {
+	} else if (fwnode_device_is_compatible(fwnode, "xlnx,zynqmp-ams")) {
 		/* add AMS channels to iio device channels */
 		memcpy(channels, ams_ctrl_channels, sizeof(ams_ctrl_channels));
 		num_channels += ARRAY_SIZE(ams_ctrl_channels);