lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171116170850.GF3187@localhost>
Date:   Thu, 16 Nov 2017 22:38:50 +0530
From:   Vinod Koul <vinod.koul@...el.com>
To:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        LKML <linux-kernel@...r.kernel.org>,
        ALSA <alsa-devel@...a-project.org>, Mark <broonie@...nel.org>,
        Takashi <tiwai@...e.de>,
        Pierre <pierre-louis.bossart@...ux.intel.com>,
        Sanyog Kale <sanyog.r.kale@...el.com>,
        Shreyas NC <shreyas.nc@...el.com>, patches.audio@...el.com,
        alan@...ux.intel.com,
        Charles Keepax <ckeepax@...nsource.cirrus.com>,
        Sagar Dharia <sdharia@...eaurora.org>, plai@...eaurora.org,
        Sudheer Papothi <spapothi@...eaurora.org>
Subject: Re: [PATCH v2 08/14] soundwire: Add Slave status handling helpers

On Thu, Nov 16, 2017 at 04:05:29PM +0000, Srinivas Kandagatla wrote:
> 
> Minor Comment!
> 
> On 10/11/17 11:49, Vinod Koul wrote:
> >From: Sanyog Kale <sanyog.r.kale@...el.com>
> >
> >SoundWire Slaves report status to bus. Add helpers to handle
> >the status changes.
> >
> >Signed-off-by: Hardik T Shah <hardik.t.shah@...el.com>
> >Signed-off-by: Sanyog Kale <sanyog.r.kale@...el.com>
> >Signed-off-by: Vinod Koul <vinod.koul@...el.com>
> >---
> 
> >+static int sdw_compare_devid(struct sdw_slave *slave, struct sdw_slave_id id)
> >+{
> >+
> >+	if ((slave->id.unique_id != id.unique_id) ||
> >+	    (slave->id.mfg_id != id.mfg_id) ||
> >+	    (slave->id.part_id != id.part_id) ||
> >+	    (slave->id.class_id != id.class_id))
> >+		return -ENODEV;
> >+
> >+	return 0;
> >+}
> >+
> >+/* called with bus_lock held */
> >+static int sdw_get_device_num(struct sdw_slave *slave)
> >+{
> If we use ida we would not need this function.

Not really, find_first_zero_bit and set_bit will be replaced by get_ida()

the bound check will still be required as we have finite set of ids to work
with. Nevertheless I will check if it helps in this case and move if
helpful.

> >+	int bit;
> >+
> >+	bit = find_first_zero_bit(slave->bus->assigned, SDW_MAX_DEVICES);
> >+	if (bit == SDW_MAX_DEVICES) {
> >+		bit = -ENODEV;
> >+		goto err;
> >+	}
> >+
> >+	/*
> >+	 * Do not update dev_num in Slave data structure here,
> >+	 * Update once program dev_num is successful
> >+	 */
> >+	set_bit(bit, slave->bus->assigned);
> >+
> >+err:
> >+	return bit;
> >+}

-- 
~Vinod

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ