Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756115AbbFQDio (ORCPT ); Tue, 16 Jun 2015 23:38:44 -0400 Received: from smtprelay0022.hostedemail.com ([216.40.44.22]:33680 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750722AbbFQDiZ (ORCPT ); Tue, 16 Jun 2015 23:38:25 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3867:3871:4321:5007:6119:6261:6742:6743:7903:10004:10400:10848:11026:11232:11658:11914:12296:12517:12519:12679:12740:13069:13157:13228:13311:13357:14096:14097:14161:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: hall27_2bbc821148c50 X-Filterd-Recvd-Size: 3162 Message-ID: <1434512299.2689.62.camel@perches.com> Subject: Re: [PATCH V2 1/6] SLIMbus: Device management on SLIMbus From: Joe Perches 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 Date: Tue, 16 Jun 2015 20:38:19 -0700 In-Reply-To: <1434505564-14333-2-git-send-email-sdharia@codeaurora.org> References: <1434505564-14333-1-git-send-email-sdharia@codeaurora.org> <1434505564-14333-2-git-send-email-sdharia@codeaurora.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1962 Lines: 63 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)); } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/