From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Subject: Re: [PATCH V2 1/6] SLIMbus: Device management on SLIMbus Date: Tue, 16 Jun 2015 20:38:19 -0700 Message-ID: <1434512299.2689.62.camel@perches.com> References: <1434505564-14333-1-git-send-email-sdharia@codeaurora.org> <1434505564-14333-2-git-send-email-sdharia@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1434505564-14333-2-git-send-email-sdharia@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org To: Sagar Dharia Cc: gregkh@linuxfoundation.org, bp@suse.de, poeschel@lemonage.de, treding@nvidia.com, broonie@kernel.org, gong.chen@linux.intel.com, andreas.noever@gmail.com, alan@linux.intel.com, mathieu.poirier@linaro.org, daniel@ffwll.ch, oded.gabbay@amd.com, jkosina@suse.cz, sharon.dvir1@mail.huji.ac.il, davem@davemloft.net, james.hogan@imgtec.com, michael.opdenacker@free-electrons.com, daniel.thompson@linaro.org, linux-kernel@vger.kernel.org, nkaje@codeaurora.org, kheitke@audience.com, mlocke@codeaurora.org, agross@codeaurora.org, linux-arm-msm@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org 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)); }