Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp320630rwd; Wed, 17 May 2023 19:24:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Ps2zVv9Bf6L9ug4ZOByBvSPLDyXKeFfFOTaXFxJnvpOEn/TWblD2qImymts6Travc6wuc X-Received: by 2002:a05:6a20:6a1e:b0:100:1ba4:d67c with SMTP id p30-20020a056a206a1e00b001001ba4d67cmr387028pzk.62.1684376685284; Wed, 17 May 2023 19:24:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684376685; cv=none; d=google.com; s=arc-20160816; b=dA6RwuyQkUqnyaZvATw+HYUvfEMYVm3FT+p32+Qb0U5A+nTXrqoxtWNskMW/UuUzHJ Fjee2U/B44ifE7L59v5wfjVqy9MhQp4sD5Xhq3YEG07cVtcysE6CLq4UZyPm6HdsUC/m yl2XZWz7RXLHkB/mr+Sek7Azp0iTJohrBPUVERPx3hWHNgI6JclubT08SAnBECu1yldb I5NGCXLsqM2Woc3DvVE6Cpt5PtHD7fonwOKiMJJutY5uYP3qwa2gHDA4TgP1mcf/IOWx aETsuAs6qDqO9UrzjwHad9NyyiTHHMarbRAdbR8/+dEZTYCUYM1COOThq7Gihopr7Qsg aQ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=531d4qj0XWfcAD/t1bH3mST8ltUsTWue6JUJG4gf6Ms=; b=bCn/XZ4tv6pGplKI4R8IbwRIHZOvDdSTtM0peZe9ELA+3MDB8XV3IRBo9xFEAKCMAB zVD0Ds53cmpxcZ0z2kaiZ/ko3RMv2GHQO8sFUpvVP7GEkD+qlzkr30WHSx/r9KGFYTD2 1OXpVFiXy9aI0Vrq02gh2SrwTE2w2e3fxXamyak/Ew40TFwSZr00UYdK/1Mzd+RlaRXW v2wI0uaQlCeVJetmebwUwyu9QVwA7EQj/D5vOvmq1e+Sl9os0LCH96LbL8U2ga9//qNH RaBUqVyRK99WeXQ0dcT+dWtDVI+24QnMB5DVR9aNOCIm2Kgjn5p3Gbb8cbu0CDCMOuVB F70Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AJB4T5uN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a17090a564a00b00253555e5f95si523018pji.153.2023.05.17.19.24.31; Wed, 17 May 2023 19:24:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AJB4T5uN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229699AbjERCUo (ORCPT + 99 others); Wed, 17 May 2023 22:20:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229563AbjERCUj (ORCPT ); Wed, 17 May 2023 22:20:39 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E718A2139 for ; Wed, 17 May 2023 19:20:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684376438; x=1715912438; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hC2J1w9UVcDCukApVbW8vB9WSP4jIPusaB43jqHzChY=; b=AJB4T5uN14PWcqj0WvIB7OpjEgUDF/0yt2JCx3spssyrX2iW+oetL3Jx mihPA7H7CXbbX4bF8Rx4qrvmq6sDKPnEqsaC7sEMy4qpVCDj0RuDbMXzo fO6pP3kghw2qaUxcEeCfu+uZ2HwiFyOguvkJznMWiRD3oX/J8A1VUrRjF hCViObjJVywdkwbtMPRpuLI3O1WLIAwD/xTAPrseKiktI1OZHOR1E7CFH jPYb/2Kh/Zew9wztbgJWUeW/LEkjiDEX/e7yGPLSIgEGfij021dtISQnq S+H5ltn8WOQfpdWedssOIk9weZ3S6Q09P07zVjlnZ8tqsOVDiheYx1YH6 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10713"; a="336504781" X-IronPort-AV: E=Sophos;i="5.99,284,1677571200"; d="scan'208";a="336504781" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2023 19:20:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10713"; a="826195226" X-IronPort-AV: E=Sophos;i="5.99,284,1677571200"; d="scan'208";a="826195226" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2023 19:20:36 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH 3/3] soundwire: cadence: revisit parity injection Date: Thu, 18 May 2023 10:41:19 +0800 Message-Id: <20230518024119.164160-4-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230518024119.164160-1-yung-chuan.liao@linux.intel.com> References: <20230518024119.164160-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart We want to wait for the CONFIG_UPDATE bit to clear before doing something else. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Bard Liao --- drivers/soundwire/cadence_master.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index 58686ae50bbf..0efc1c3bee5f 100644 --- a/drivers/soundwire/cadence_master.c +++ b/drivers/soundwire/cadence_master.c @@ -456,9 +456,9 @@ static int cdns_parity_error_injection(void *data, u64 value) CDNS_IP_MCP_CMDCTRL_INSERT_PARITY_ERR); /* commit changes */ - cdns_updatel(cdns, CDNS_MCP_CONFIG_UPDATE, - CDNS_MCP_CONFIG_UPDATE_BIT, - CDNS_MCP_CONFIG_UPDATE_BIT); + ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, CDNS_MCP_CONFIG_UPDATE_BIT); + if (ret < 0) + goto unlock; /* do a broadcast dummy read to avoid bus clashes */ ret = sdw_bread_no_pm_unlocked(&cdns->bus, 0xf, SDW_SCP_DEVID_0); @@ -470,16 +470,17 @@ static int cdns_parity_error_injection(void *data, u64 value) 0); /* commit changes */ - cdns_updatel(cdns, CDNS_MCP_CONFIG_UPDATE, - CDNS_MCP_CONFIG_UPDATE_BIT, - CDNS_MCP_CONFIG_UPDATE_BIT); + ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, CDNS_MCP_CONFIG_UPDATE_BIT); + if (ret < 0) + goto unlock; + /* Userspace changed the hardware state behind the kernel's back */ + add_taint(TAINT_USER, LOCKDEP_STILL_OK); + +unlock: /* Continue bus operation with parity error injection disabled */ mutex_unlock(&bus->bus_lock); - /* Userspace changed the hardware state behind the kernel's back */ - add_taint(TAINT_USER, LOCKDEP_STILL_OK); - /* * allow Master device to enter pm_runtime suspend. This may * also result in Slave devices suspending. -- 2.25.1