Message ID | 20190723193750.69038-1-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | bc7514925cf50bf81f514d0f2d7521b25973a639 |
Headers | show |
Series | [v1] usb: typec: tcpm: Switch to use fwnode_property_count_uXX() | expand |
On Tue, Jul 23, 2019 at 10:37:50PM +0300, Andy Shevchenko wrote: > Use use fwnode_property_count_uXX() directly, that makes code neater. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> > --- > drivers/usb/typec/tcpm/tcpm.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index fba32d84e578..ec525811a9eb 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -4410,8 +4410,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, > goto sink; > > /* Get source pdos */ > - ret = fwnode_property_read_u32_array(fwnode, "source-pdos", > - NULL, 0); > + ret = fwnode_property_count_u32(fwnode, "source-pdos"); > if (ret <= 0) > return -EINVAL; > > @@ -4435,8 +4434,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, > return -EINVAL; > sink: > /* Get sink pdos */ > - ret = fwnode_property_read_u32_array(fwnode, "sink-pdos", > - NULL, 0); > + ret = fwnode_property_count_u32(fwnode, "sink-pdos"); > if (ret <= 0) > return -EINVAL; > > -- > 2.20.1 >
On Tue, Jul 23, 2019 at 10:37:50PM +0300, Andy Shevchenko wrote: > Use use fwnode_property_count_uXX() directly, that makes code neater. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > drivers/usb/typec/tcpm/tcpm.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index fba32d84e578..ec525811a9eb 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -4410,8 +4410,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, > goto sink; > > /* Get source pdos */ > - ret = fwnode_property_read_u32_array(fwnode, "source-pdos", > - NULL, 0); > + ret = fwnode_property_count_u32(fwnode, "source-pdos"); > if (ret <= 0) > return -EINVAL; > > @@ -4435,8 +4434,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, > return -EINVAL; > sink: > /* Get sink pdos */ > - ret = fwnode_property_read_u32_array(fwnode, "sink-pdos", > - NULL, 0); > + ret = fwnode_property_count_u32(fwnode, "sink-pdos"); > if (ret <= 0) > return -EINVAL; > > -- > 2.20.1 thanks,
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index fba32d84e578..ec525811a9eb 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -4410,8 +4410,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, goto sink; /* Get source pdos */ - ret = fwnode_property_read_u32_array(fwnode, "source-pdos", - NULL, 0); + ret = fwnode_property_count_u32(fwnode, "source-pdos"); if (ret <= 0) return -EINVAL; @@ -4435,8 +4434,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, return -EINVAL; sink: /* Get sink pdos */ - ret = fwnode_property_read_u32_array(fwnode, "sink-pdos", - NULL, 0); + ret = fwnode_property_count_u32(fwnode, "sink-pdos"); if (ret <= 0) return -EINVAL;
Use use fwnode_property_count_uXX() directly, that makes code neater. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/usb/typec/tcpm/tcpm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)