From: zhoumin <teczm@foxmail.com>
To: dlemoal@kernel.org, cassel@kernel.org
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
teczm@foxmail.com
Subject: [PATCH] ata: ahci: preserve preset port masks
Date: Thu, 15 Oct 2026 11:06:55 +0800 [thread overview]
Message-ID: <tencent_E0E7052529B6851284963EB90DF4D28CBB06@qq.com> (raw)
ahci_get_port_mask() returns zero for absent or unmatched parameters,
overwriting the mask set by the Marvell PATA quirk.
Update the mask in place only when parsing a global value or a matching
device entry. Preserve existing numeric parsing and override behavior.
Fixes: 70c1595c181c ("ata: ahci: Allow ignoring the external/hotplug capability of ports")
Signed-off-by: zhoumin <teczm@foxmail.com>
---
drivers/ata/ahci.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 9b8c0935001c..324e4918a055 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1654,22 +1654,21 @@ static u32 ahci_port_mask(struct device *dev, char *mask_s)
return mask;
}
-static u32 ahci_get_port_mask(struct device *dev, char *mask_p)
+static void ahci_get_port_mask(struct device *dev, char *mask_p, u32 *mask)
{
char *param, *end, *str, *mask_s;
char *name;
- u32 mask = 0;
if (!mask_p || !strlen(mask_p))
- return 0;
+ return;
str = kstrdup(mask_p, GFP_KERNEL);
if (!str)
- return 0;
+ return;
/* Handle single mask case */
if (!strchr(str, '=')) {
- mask = ahci_port_mask(dev, str);
+ *mask = ahci_port_mask(dev, str);
goto free;
}
@@ -1704,13 +1703,11 @@ static u32 ahci_get_port_mask(struct device *dev, char *mask_p)
param++;
}
- mask = ahci_port_mask(dev, mask_s);
+ *mask = ahci_port_mask(dev, mask_s);
}
free:
kfree(str);
-
- return mask;
}
static void ahci_pci_save_initial_config(struct pci_dev *pdev,
@@ -1736,10 +1733,10 @@ static void ahci_pci_save_initial_config(struct pci_dev *pdev,
}
/* Handle port map masks passed as module parameter. */
- hpriv->mask_port_map =
- ahci_get_port_mask(&pdev->dev, ahci_mask_port_map);
- hpriv->mask_port_ext =
- ahci_get_port_mask(&pdev->dev, ahci_mask_port_ext);
+ ahci_get_port_mask(&pdev->dev, ahci_mask_port_map,
+ &hpriv->mask_port_map);
+ ahci_get_port_mask(&pdev->dev, ahci_mask_port_ext,
+ &hpriv->mask_port_ext);
ahci_save_initial_config(&pdev->dev, hpriv);
}
--
2.53.0
next reply other threads:[~2026-10-15 3:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 3:06 zhoumin [this message]
2026-10-15 5:44 ` Damien Le Moal
2026-10-15 7:59 ` Niklas Cassel
2026-10-15 9:41 ` [PATCH v2] " zhoumin
2026-10-15 10:55 ` Niklas Cassel
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=tencent_E0E7052529B6851284963EB90DF4D28CBB06@qq.com \
--to=teczm@foxmail.com \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®