Messages in this thread | | | Subject | Re: [PATCH V2 1/6] SLIMbus: Device management on SLIMbus | From | Joe Perches <> | Date | Tue, 16 Jun 2015 20:38:19 -0700 |
| |
On Tue, 2015-06-16 at 19:45 -0600, Sagar Dharia wrote: > SLIMbus (Serial Low Power Interchip Media Bus) is a specification > developed by MIPI (Mobile Industry Processor Interface) alliance. > SLIMbus is a 2-wire implementation, which is used to communicate with > peripheral components like audio-codec. [] > diff --git a/drivers/slimbus/slimbus.c b/drivers/slimbus/slimbus.c [] > +static bool slim_eaddr_equal(struct slim_eaddr *a, struct slim_eaddr *b) > +{ > + return (a->manf_id == b->manf_id && > + a->prod_code == b->prod_code && > + a->dev_index == b->dev_index && > + a->instance == b->instance); > +} > + > +static const struct slim_device_id * > +slim_match(const struct slim_device_id *id, const struct slim_device *slim_dev) > +{ > + while (id->manf_id != 0 || id->prod_code != 0) { > + if (id->manf_id == slim_dev->e_addr.manf_id && > + id->prod_code == slim_dev->e_addr.prod_code && > + id->dev_index == slim_dev->e_addr.dev_index) > + return id; > + id++; > + } > + return NULL; > +} > + > +static int slim_device_match(struct device *dev, struct device_driver *driver) > +{ > + struct slim_device *slim_dev; > + struct slim_driver *drv = to_slim_driver(driver); > + > + if (dev->type != &slim_dev_type) > + return 0; > + > + slim_dev = to_slim_device(dev); > + if (drv->id_table) > + return slim_match(drv->id_table, slim_dev) != NULL; > + return 0; > +}
This should probably be a bool function return.
Maybe this:
static bool slim_device_match(struct device *dev, struct device_driver *driver) { struct slim_driver *drv = to_slim_driver(driver);
if (dev->type != &slim_dev_type || !drv->id_table) return false;
return slim_match(drv->id_table, to_slim_device(dev)); }
| |