From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753203AbdLDDJr (ORCPT ); Sun, 3 Dec 2017 22:09:47 -0500 Received: from mga07.intel.com ([134.134.136.100]:40321 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753178AbdLDDJq (ORCPT ); Sun, 3 Dec 2017 22:09:46 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,357,1508828400"; d="scan'208";a="9159050" Date: Mon, 4 Dec 2017 08:43:20 +0530 From: Vinod Koul To: Pierre-Louis Bossart Cc: Greg Kroah-Hartman , LKML , ALSA , Mark , Takashi , patches.audio@intel.com, alan@linux.intel.com, Charles Keepax , Sagar Dharia , srinivas.kandagatla@linaro.org, plai@codeaurora.org, Sudheer Papothi Subject: Re: [alsa-devel] [PATCH v4 08/15] soundwire: Add Slave status handling helpers 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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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