From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vinod Koul Subject: Re: [PATCH v4 08/15] soundwire: Add Slave status handling helpers Date: Mon, 4 Dec 2017 08:43:20 +0530 Message-ID: <20171204031319.GW32417@localhost> References: <1512122177-2889-1-git-send-email-vinod.koul@intel.com> <1512122177-2889-9-git-send-email-vinod.koul@intel.com> <4b464ced-5801-724e-1ec0-bae5b468b4dd@linux.intel.com> <20171203170818.GO32417@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by alsa0.perex.cz (Postfix) with ESMTP id B7F2F26710B for ; Mon, 4 Dec 2017 04:09:47 +0100 (CET) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Pierre-Louis Bossart Cc: ALSA , Charles Keepax , Sudheer Papothi , Takashi , Greg Kroah-Hartman , plai@codeaurora.org, LKML , patches.audio@intel.com, Mark , srinivas.kandagatla@linaro.org, Sagar Dharia , alan@linux.intel.com List-Id: alsa-devel@alsa-project.org On Sun, Dec 03, 2017 at 09:07:29PM -0600, Pierre-Louis Bossart wrote: > On 12/3/17 11:08 AM, Vinod Koul wrote: > >On Fri, Dec 01, 2017 at 05:36:47PM -0600, Pierre-Louis Bossart wrote: > > > >>>+/* called with bus_lock held */ > >>>+static int sdw_get_device_num(struct sdw_slave *slave) > >>>+{ > >>>+ int bit; > >>>+ > >>>+ bit = find_first_zero_bit(slave->bus->assigned, SDW_MAX_DEVICES); > >>>+ if (bit == SDW_MAX_DEVICES) { > >>>+ bit = -ENODEV; > >>>+ goto err; > >> > >>My brain is starting to fry but is this correct? Bit11 seems like a valid > >>value. Should it be bit > 15 (assuming bit 12,13,14 are set to avoid using > >>groups and master)? > > > >this is correct. You are confusing SDW concept and API return types! > >That should be hint for you to start weekend if you didn't do so :D > > > >This API returns max value it was provided (last arg) if it doesn't > >find free bit. That's an indication to caller that we ran out of devices > >hence ENODEV error! > > Can you just make sure bit11 is included? yes it is, refer to the masks we set for bit, only 0 and 15 and now 12,13 and 14 will be masked out. So we can get from 1 to 11 both inclusive. -- ~Vinod