linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Hsiao <matt.hsiao@hpe.com>
To: linux-kernel@vger.kernel.org
Cc: arnd@arndb.de, gregkh@linuxfoundation.org,
	david.altobelli@hpe.com, mark.rusk@hpe.com,
	jerry.hoemann@hpe.com, Matt Hsiao <matt.hsiao@hpe.com>
Subject: [PATCH v2 1/2] misc: hpilo: Exclude unsupported device via blacklist
Date: Wed, 27 Feb 2019 11:25:29 +0800	[thread overview]
Message-ID: <1551237930-28823-2-git-send-email-matt.hsiao@hpe.com> (raw)
In-Reply-To: <1551237930-28823-1-git-send-email-matt.hsiao@hpe.com>

Instead of having explicit if statements excluding devices,
use a pci_device_id table of devices to blacklist.

HPE will put out minor updates to the iLO using the same device
info except for the subsystem device id. hpilo driver takes the
approach to claim based upon {Vendor, Device, SubVendor} and it
allows old software to work on new hardware without patching.

As our primary way to support our customers is via distros, the
patching process could take months to go upstream and then
backported to multiple releases of multiple distros.

This approach worked fairly well as this is only the second time
in 10+ years that we need to blacklist an instance.

Signed-off-by: Matt Hsiao <matt.hsiao@hpe.com>
---
 drivers/misc/hpilo.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c
index e9c9ef5..0224e50 100644
--- a/drivers/misc/hpilo.c
+++ b/drivers/misc/hpilo.c
@@ -29,6 +29,11 @@
 static unsigned int ilo_major;
 static unsigned int max_ccb = 16;
 static char ilo_hwdev[MAX_ILO_DEV];
+static const struct pci_device_id ilo_blacklist[] = {
+	/* auxiliary iLO */
+	{PCI_DEVICE_SUB(PCI_VENDOR_ID_HP, 0x3307, PCI_VENDOR_ID_HP, 0x1979)},
+	{}
+};
 
 static inline int get_entry_id(int entry)
 {
@@ -763,9 +768,10 @@ static int ilo_probe(struct pci_dev *pdev,
 	int devnum, minor, start, error = 0;
 	struct ilo_hwinfo *ilo_hw;
 
-	/* Ignore subsystem_device = 0x1979 (set by BIOS)  */
-	if (pdev->subsystem_device == 0x1979)
-		return 0;
+	if (pci_match_id(ilo_blacklist, pdev)) {
+		dev_dbg(&pdev->dev, "Not supported on this device\n");
+		return -ENODEV;
+	}
 
 	if (max_ccb > MAX_CCB)
 		max_ccb = MAX_CCB;
-- 
1.8.3.1


  reply	other threads:[~2019-02-27  3:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27  3:25 [PATCH v2 0/2] misc: hpilo: Do not claim on unsupported hardware Matt Hsiao
2019-02-27  3:25 ` Matt Hsiao [this message]
2019-02-27  3:25 ` [PATCH v2 2/2] misc: hpilo: Do not claim " Matt Hsiao

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=1551237930-28823-2-git-send-email-matt.hsiao@hpe.com \
    --to=matt.hsiao@hpe.com \
    --cc=arnd@arndb.de \
    --cc=david.altobelli@hpe.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jerry.hoemann@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rusk@hpe.com \
    /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;
as well as URLs for NNTP newsgroup(s).