Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp349849ybi; Fri, 26 Jul 2019 10:47:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLS8/djgOkIr789mYqMwiAfoQ/WJfhBBgWqBFwMK3poZLtKIj0yoe2xY4LowCtUFRZKd8X X-Received: by 2002:a63:7455:: with SMTP id e21mr87417968pgn.439.1564163233754; Fri, 26 Jul 2019 10:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564163233; cv=none; d=google.com; s=arc-20160816; b=Zbo73TCv7BCNTbWQiHCqnBP5RdUMGIRHU2mTNwMpbXUsntv4skSCoPBPJ+/f7GQ/51 3pSxhWbtoyB4Jm4Gr4yhX8Wfg0bMQuk3cYCkCVJ2eragydxSfLrd+4sUMiRVv2URmEaL eX4EFJsVFtZRfCJERYLJ1wy5ItPffzcshFWykSlGL3Aa4G6zeZPTMpjHK5Qjh01cNCOQ Ux5/LC+eqoW/9HcYLHLLNPYU58ZC0RZuiEry9tZuqdhQzIa84Hd/9SuL/j3KHF41cQ+s jSZQd4HQe+1QGNs+FsdqaWqaNGCLQ580UbB2pMnKDon9hbDUha5BSelNgKMtqc4CfjsM mOyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=2awpLfeHVRF8FAPjLzwNepJtIwjBUZhfwWISL7cPRZw=; b=ZAfYXsSXsciFrdO4GLltRwdo/0MmZHTSMms0pbhVnoBiD20k+jo9CCuyylX7QMTyPS 1hehLW+sczavun6cut9lKutaxva0InzqvhphdsDW8Au/N0dOwBudg7w+07rGpHyB6MWQ DT7MCMOwMR4unc8/794scaSkKw6jwTkklcApfJs0hB7M4Y3yucsvArAqB0AQSuuj4sed qTBEdWo4urFrdsYwBUOl3YY9Yggu4G3SqMCub5TO3G9WDhiXI4BhVue2om0dSBWiuXT9 sRjPih/xWpsRfjEl1bKoFIAG99Ruplf7RTxXbhVxJgtXab0RoUIC6aq8dpxksj83ZnR/ YGbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4si22750247pgu.194.2019.07.26.10.46.58; Fri, 26 Jul 2019 10:47:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727506AbfGZOJ7 (ORCPT + 99 others); Fri, 26 Jul 2019 10:09:59 -0400 Received: from mga09.intel.com ([134.134.136.24]:50913 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726902AbfGZOJ7 (ORCPT ); Fri, 26 Jul 2019 10:09:59 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jul 2019 07:09:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,311,1559545200"; d="scan'208";a="322049406" Received: from msmall-mobl.amr.corp.intel.com (HELO [10.251.154.62]) ([10.251.154.62]) by orsmga004.jf.intel.com with ESMTP; 26 Jul 2019 07:09:56 -0700 Subject: Re: [alsa-devel] [RFC PATCH 15/40] soundwire: cadence_master: handle multiple status reports per Slave To: Guennadi Liakhovetski Cc: alsa-devel@alsa-project.org, tiwai@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, slawomir.blauciak@intel.com, Sanyog Kale References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-16-pierre-louis.bossart@linux.intel.com> <20190725223100.GC16003@ubuntu> From: Pierre-Louis Bossart Message-ID: Date: Fri, 26 Jul 2019 09:09:56 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190725223100.GC16003@ubuntu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c >> index 889fa2cd49ae..25d5c7267c15 100644 >> --- a/drivers/soundwire/cadence_master.c >> +++ b/drivers/soundwire/cadence_master.c >> @@ -643,13 +643,35 @@ static int cdns_update_slave_status(struct sdw_cdns *cdns, >> >> /* first check if Slave reported multiple status */ >> if (set_status > 1) { >> + u32 val; >> + >> dev_warn_ratelimited(cdns->dev, >> - "Slave reported multiple Status: %d\n", >> - mask); >> - /* >> - * TODO: we need to reread the status here by >> - * issuing a PING cmd >> - */ >> + "Slave %d reported multiple Status: %d\n", >> + i, mask); >> + >> + /* re-check latest status extracted from PING commands */ >> + val = cdns_readl(cdns, CDNS_MCP_SLAVE_STAT); >> + val >>= (i * 2); > > Superfluous parentheses. Humm, I don't know my left from my right and I can't remember operator precedence, so i'd rather make it explicit... > >> + >> + switch (val & 0x3) { >> + case 0: >> + status[i] = SDW_SLAVE_UNATTACHED; >> + break; >> + case 1: >> + status[i] = SDW_SLAVE_ATTACHED; >> + break; >> + case 2: >> + status[i] = SDW_SLAVE_ALERT; >> + break; >> + default: > > There aren't many values left for the "default" case :-) But I'm not sure whether > any of > > + case 3: > > or > > + case 3: > + default: > > would improve readability. > > Thanks > Guennadi > >> + status[i] = SDW_SLAVE_RESERVED; >> + break; Yes, those defaults are annoying. Some tools complain so I tend to leave them.