All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Sagar Dharia <sdharia@codeaurora.org>
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
Subject: Re: [PATCH V2 1/6] SLIMbus: Device management on SLIMbus
Date: Tue, 16 Jun 2015 20:38:19 -0700	[thread overview]
Message-ID: <1434512299.2689.62.camel@perches.com> (raw)
In-Reply-To: <1434505564-14333-2-git-send-email-sdharia@codeaurora.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));
}

  reply	other threads:[~2015-06-17  3:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-17  1:45 [PATCH V2 0/6] Introduce framework for SLIMbus device drivers Sagar Dharia
2015-06-17  1:45 ` [PATCH V2 1/6] SLIMbus: Device management on SLIMbus Sagar Dharia
2015-06-17  3:38   ` Joe Perches [this message]
2015-06-17 13:16   ` Mark Brown
2015-06-17 17:36     ` Sagar Dharia
2015-06-18 21:39   ` Srinivas Kandagatla
2015-06-19  8:22   ` Daniel Thompson
2015-06-17  1:46 ` [PATCH V2 2/6] of/slimbus: OF helper for SLIMbus Sagar Dharia
2015-06-17 13:09   ` Mark Brown
2015-06-17 17:01     ` Sagar Dharia
2015-06-17  1:46 ` [PATCH V2 3/6] slimbus: Add messaging APIs to slimbus framework Sagar Dharia
2015-06-17  1:46 ` [PATCH V2 4/6] slim: qcom: Add Qualcomm Slimbus controller driver Sagar Dharia
2015-06-17 13:53   ` Mark Brown
2015-06-28 19:13     ` Sagar Dharia
2015-06-17  1:46 ` [PATCH V2 5/6] slimbus: Add support for 'clock-pause' feature Sagar Dharia
2015-06-17  1:46 ` [PATCH V2 6/6] slim: qcom: Add runtime-pm support using clock-pause feature Sagar Dharia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434512299.2689.62.camel@perches.com \
    --to=joe@perches.com \
    --cc=agross@codeaurora.org \
    --cc=alan@linux.intel.com \
    --cc=andreas.noever@gmail.com \
    --cc=bp@suse.de \
    --cc=broonie@kernel.org \
    --cc=daniel.thompson@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=davem@davemloft.net \
    --cc=gong.chen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=james.hogan@imgtec.com \
    --cc=jkosina@suse.cz \
    --cc=kheitke@audience.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=michael.opdenacker@free-electrons.com \
    --cc=mlocke@codeaurora.org \
    --cc=nkaje@codeaurora.org \
    --cc=oded.gabbay@amd.com \
    --cc=poeschel@lemonage.de \
    --cc=sdharia@codeaurora.org \
    --cc=sharon.dvir1@mail.huji.ac.il \
    --cc=treding@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.