Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, ChanWoo Lee <cw9316.lee@samsung.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1 22/71] mmc: Avoid open coding by using mmc_op_tuning()
Date: Sun,  1 Sep 2024 18:17:27 +0200	[thread overview]
Message-ID: <20240901160802.725682051@linuxfoundation.org> (raw)
In-Reply-To: <20240901160801.879647959@linuxfoundation.org>

6.1-stable review patch.  If anyone has any objections, please let me know.

------------------

From: ChanWoo Lee <cw9316.lee@samsung.com>

[ Upstream commit b98e7e8daf0ebab9dcc36812378a71e1be0b5089 ]

Replace code with the already defined function. No functional changes.

Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20221124080031.14690-1-cw9316.lee@samsung.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Stable-dep-of: 9374ae912dbb ("mmc: mtk-sd: receive cmd8 data when hs400 tuning fail")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mmc/core/core.c              | 3 +--
 drivers/mmc/host/dw_mmc.c            | 3 +--
 drivers/mmc/host/mtk-sd.c            | 8 ++------
 drivers/mmc/host/sdhci-msm.c         | 3 +--
 drivers/mmc/host/sdhci-pci-o2micro.c | 3 +--
 drivers/mmc/host/sdhci-tegra.c       | 8 ++------
 drivers/mmc/host/sdhci.c             | 9 ++-------
 7 files changed, 10 insertions(+), 27 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index df85c35a86a3b..fc2fca5325ba5 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -142,8 +142,7 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
 	int err = cmd->error;
 
 	/* Flag re-tuning needed on CRC errors */
-	if (cmd->opcode != MMC_SEND_TUNING_BLOCK &&
-	    cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200 &&
+	if (!mmc_op_tuning(cmd->opcode) &&
 	    !host->retune_crc_disable &&
 	    (err == -EILSEQ || (mrq->sbc && mrq->sbc->error == -EILSEQ) ||
 	    (mrq->data && mrq->data->error == -EILSEQ) ||
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index a0ccf88876f98..d0da4573b38cd 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -334,8 +334,7 @@ static u32 dw_mci_prep_stop_abort(struct dw_mci *host, struct mmc_command *cmd)
 	    cmdr == MMC_READ_MULTIPLE_BLOCK ||
 	    cmdr == MMC_WRITE_BLOCK ||
 	    cmdr == MMC_WRITE_MULTIPLE_BLOCK ||
-	    cmdr == MMC_SEND_TUNING_BLOCK ||
-	    cmdr == MMC_SEND_TUNING_BLOCK_HS200 ||
+	    mmc_op_tuning(cmdr) ||
 	    cmdr == MMC_GEN_CMD) {
 		stop->opcode = MMC_STOP_TRANSMISSION;
 		stop->arg = 0;
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 70e414027155d..efd2af2d36862 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -1207,9 +1207,7 @@ static bool msdc_cmd_done(struct msdc_host *host, int events,
 
 	if (!sbc_error && !(events & MSDC_INT_CMDRDY)) {
 		if (events & MSDC_INT_CMDTMO ||
-		    (cmd->opcode != MMC_SEND_TUNING_BLOCK &&
-		     cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200 &&
-		     !host->hs400_tuning))
+		    (!mmc_op_tuning(cmd->opcode) && !host->hs400_tuning))
 			/*
 			 * should not clear fifo/interrupt as the tune data
 			 * may have alreay come when cmd19/cmd21 gets response
@@ -1303,9 +1301,7 @@ static void msdc_cmd_next(struct msdc_host *host,
 {
 	if ((cmd->error &&
 	    !(cmd->error == -EILSEQ &&
-	      (cmd->opcode == MMC_SEND_TUNING_BLOCK ||
-	       cmd->opcode == MMC_SEND_TUNING_BLOCK_HS200 ||
-	       host->hs400_tuning))) ||
+	      (mmc_op_tuning(cmd->opcode) || host->hs400_tuning))) ||
 	    (mrq->sbc && mrq->sbc->error))
 		msdc_request_done(host, mrq);
 	else if (cmd == mrq->sbc)
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index e37fb25577c0f..28bd562c439ef 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -2218,8 +2218,7 @@ static int __sdhci_msm_check_write(struct sdhci_host *host, u16 val, int reg)
 		if (!msm_host->use_cdr)
 			break;
 		if ((msm_host->transfer_mode & SDHCI_TRNS_READ) &&
-		    SDHCI_GET_CMD(val) != MMC_SEND_TUNING_BLOCK_HS200 &&
-		    SDHCI_GET_CMD(val) != MMC_SEND_TUNING_BLOCK)
+		    !mmc_op_tuning(SDHCI_GET_CMD(val)))
 			sdhci_msm_set_cdr(host, true);
 		else
 			sdhci_msm_set_cdr(host, false);
diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
index 24bb0e9809e76..cfa0956e7d72a 100644
--- a/drivers/mmc/host/sdhci-pci-o2micro.c
+++ b/drivers/mmc/host/sdhci-pci-o2micro.c
@@ -326,8 +326,7 @@ static int sdhci_o2_execute_tuning(struct mmc_host *mmc, u32 opcode)
 		(host->timing != MMC_TIMING_UHS_SDR50))
 		return sdhci_execute_tuning(mmc, opcode);
 
-	if (WARN_ON((opcode != MMC_SEND_TUNING_BLOCK_HS200) &&
-			(opcode != MMC_SEND_TUNING_BLOCK)))
+	if (WARN_ON(!mmc_op_tuning(opcode)))
 		return -EINVAL;
 
 	/* Force power mode enter L0 */
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index 1adaa94c31aca..62d236bfe9377 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -268,13 +268,9 @@ static void tegra210_sdhci_writew(struct sdhci_host *host, u16 val, int reg)
 {
 	bool is_tuning_cmd = 0;
 	bool clk_enabled;
-	u8 cmd;
 
-	if (reg == SDHCI_COMMAND) {
-		cmd = SDHCI_GET_CMD(val);
-		is_tuning_cmd = cmd == MMC_SEND_TUNING_BLOCK ||
-				cmd == MMC_SEND_TUNING_BLOCK_HS200;
-	}
+	if (reg == SDHCI_COMMAND)
+		is_tuning_cmd = mmc_op_tuning(SDHCI_GET_CMD(val));
 
 	if (is_tuning_cmd)
 		clk_enabled = tegra_sdhci_configure_card_clk(host, 0);
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 4237d8ae878c1..536d21028a116 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1712,8 +1712,7 @@ static bool sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
 		flags |= SDHCI_CMD_INDEX;
 
 	/* CMD19 is special in that the Data Present Select should be set */
-	if (cmd->data || cmd->opcode == MMC_SEND_TUNING_BLOCK ||
-	    cmd->opcode == MMC_SEND_TUNING_BLOCK_HS200)
+	if (cmd->data || mmc_op_tuning(cmd->opcode))
 		flags |= SDHCI_CMD_DATA;
 
 	timeout = jiffies;
@@ -3396,8 +3395,6 @@ static void sdhci_adma_show_error(struct sdhci_host *host)
 
 static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
 {
-	u32 command;
-
 	/*
 	 * CMD19 generates _only_ Buffer Read Ready interrupt if
 	 * use sdhci_send_tuning.
@@ -3406,9 +3403,7 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
 	 * SDHCI_INT_DATA_AVAIL always there, stuck in irq storm.
 	 */
 	if (intmask & SDHCI_INT_DATA_AVAIL && !host->data) {
-		command = SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND));
-		if (command == MMC_SEND_TUNING_BLOCK ||
-		    command == MMC_SEND_TUNING_BLOCK_HS200) {
+		if (mmc_op_tuning(SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND)))) {
 			host->tuning_done = 1;
 			wake_up(&host->buf_ready_int);
 			return;
-- 
2.43.0




  parent reply	other threads:[~2024-09-01 16:47 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-01 16:17 [PATCH 6.1 00/71] 6.1.108-rc1 review Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 01/71] drm/amdgpu: Using uninitialized value *size when calling amdgpu_vce_cs_reloc Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 02/71] LoongArch: Remove the unused dma-direct.h Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 03/71] btrfs: run delayed iputs when flushing delalloc Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 04/71] smb/client: avoid dereferencing rdata=NULL in smb2_new_read_req() Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 05/71] pinctrl: rockchip: correct RK3328 iomux width flag for GPIO2-B pins Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 06/71] pinctrl: single: fix potential NULL dereference in pcs_get_function() Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 07/71] of: Add cleanup.h based auto release via __free(device_node) markings Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 08/71] wifi: wfx: repair open network AP mode Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 09/71] wifi: mwifiex: duplicate static structs used in driver instances Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 10/71] net: mana: Fix race of mana_hwc_post_rx_wqe and new hwc response Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 11/71] mptcp: close subflow when receiving TCP+FIN Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 12/71] mptcp: sched: check both backup in retrans Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 13/71] mptcp: pm: skip connecting to already established sf Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 14/71] mptcp: pm: reset MPC endp ID when re-added Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 15/71] mptcp: pm: send ACK on an active subflow Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 16/71] mptcp: pm: do not remove already closed subflows Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 17/71] mptcp: pm: ADD_ADDR 0 is not a new address Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 18/71] drm/amdgpu: align pp_power_profile_mode with kernel docs Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 19/71] drm/amdgpu/swsmu: always force a state reprogram on init Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 20/71] ata: libata-core: Fix null pointer dereference on error Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 21/71] usb: typec: fix up incorrectly backported "usb: typec: tcpm: unregister existing source caps before re-registration" Greg Kroah-Hartman
2024-09-01 16:17 ` Greg Kroah-Hartman [this message]
2024-09-01 16:17 ` [PATCH 6.1 23/71] mmc: mtk-sd: receive cmd8 data when hs400 tuning fail Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 24/71] mptcp: unify pm get_local_id interfaces Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 25/71] mptcp: pm: remove mptcp_pm_remove_subflow() Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 26/71] mptcp: pm: only mark subflow endp as available Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 27/71] mptcp: pm: check add_addr_accept_max before accepting new ADD_ADDR Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 28/71] of: Introduce for_each_*_child_of_node_scoped() to automate of_node_put() handling Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 29/71] thermal: of: Fix OF node leak in thermal_of_trips_init() error path Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 30/71] thermal: of: Fix OF node leak in of_thermal_zone_find() error paths Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 31/71] ASoC: amd: acp: fix module autoloading Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 32/71] ASoC: SOF: amd: Fix for acp init sequence Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 33/71] pinctrl: mediatek: common-v2: Fix broken bias-disable for PULL_PU_PD_RSEL_TYPE Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 34/71] mm: Fix missing folio invalidation calls during truncation Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 35/71] btrfs: fix extent map use-after-free when adding pages to compressed bio Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 36/71] soundwire: stream: fix programming slave ports for non-continous port maps Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 37/71] phy: xilinx: add runtime PM support Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 38/71] phy: xilinx: phy-zynqmp: dynamic clock support for power-save Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 39/71] phy: xilinx: phy-zynqmp: Fix SGMII linkup failure on resume Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 40/71] dmaengine: dw: Add peripheral bus width verification Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 41/71] dmaengine: dw: Add memory " Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 42/71] Bluetooth: hci_core: Fix not handling hibernation actions Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 43/71] iommu: Do not return 0 from map_pages if it doesnt do anything Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 44/71] netfilter: nf_tables: restore IP sanity checks for netdev/egress Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 45/71] wifi: iwlwifi: fw: fix wgds rev 3 exact size Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 46/71] ethtool: check device is present when getting link settings Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 47/71] netfilter: nf_tables_ipv6: consider network offset in netdev/egress validation Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 48/71] selftests: forwarding: no_forwarding: Down ports on cleanup Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 49/71] selftests: forwarding: local_termination: " Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 50/71] bonding: implement xdo_dev_state_free and call it after deletion Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 51/71] gtp: fix a potential NULL pointer dereference Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 52/71] sctp: fix association labeling in the duplicate COOKIE-ECHO case Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 53/71] drm/amd/display: avoid using null object of framebuffer Greg Kroah-Hartman
2024-09-01 16:17 ` [PATCH 6.1 54/71] net: busy-poll: use ktime_get_ns() instead of local_clock() Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 55/71] nfc: pn533: Add poll mod list filling check Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 56/71] soc: qcom: cmd-db: Map shared memory as WC, not WB Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 57/71] cdc-acm: Add DISABLE_ECHO quirk for GE HealthCare UI Controller Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 58/71] USB: serial: option: add MeiG Smart SRM825L Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 59/71] usb: dwc3: omap: add missing depopulate in probe error path Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 60/71] usb: dwc3: core: Prevent USB core invalid event buffer address access Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 61/71] usb: dwc3: st: fix probed platform device ref count on probe error path Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 62/71] usb: dwc3: st: add missing depopulate in " Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 63/71] usb: core: sysfs: Unmerge @usb3_hardware_lpm_attr_group in remove_power_attributes() Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 64/71] usb: cdnsp: fix incorrect index in cdnsp_get_hw_deq function Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 65/71] usb: cdnsp: fix for Link TRB with TC Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 66/71] phy: zynqmp: Enable reference clock correctly Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 67/71] igc: Fix reset adapter logics when tx mode change Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 68/71] igc: Fix qbv tx latency by setting gtxoffset Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 69/71] scsi: aacraid: Fix double-free on probe failure Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 70/71] apparmor: fix policy_unpack_test on big endian systems Greg Kroah-Hartman
2024-09-01 16:18 ` [PATCH 6.1 71/71] fbdev: offb: fix up missing cleanup.h Greg Kroah-Hartman
2024-09-02  7:10 ` [PATCH 6.1 00/71] 6.1.108-rc1 review Pavel Machek
2024-09-02 15:42 ` Naresh Kamboju
2024-09-02 18:55 ` Florian Fainelli
2024-09-03  7:23 ` Ron Economos
2024-09-03  8:44 ` Jon Hunter
2024-09-03 11:48 ` Mark Brown
2024-09-04  7:24 ` Yann Sionneau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240901160802.725682051@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=adrian.hunter@intel.com \
    --cc=cw9316.lee@samsung.com \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox