From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Don Brace <don.brace@microsemi.com>,
Christoph Hellwig <hch@lst.de>,
James Bottomley <james.bottomley@hansenpartnership.com>,
Meelis Roos <mroos@linux.ee>,
linux-scsi@vger.kernel.org, Jeff Mahoney <jeffm@suse.com>
Subject: [PATCH 6/6] hpsa: handle unsupported devices more gracefully
Date: Tue, 8 Aug 2017 10:35:15 +0200 [thread overview]
Message-ID: <1502181315-102499-7-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1502181315-102499-1-git-send-email-hare@suse.de>
From: Jeff Mahoney <jeffm@suse.com>
Add a warning message if an unsupported device is found and the
hpsa_allow_any parameter is not set.
Also make the hpsa_allow_any parameter writeable once the hpsa
driver is loaded.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
drivers/scsi/hpsa.c | 43 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 40 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 790958f..d523ec0 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -82,10 +82,19 @@
MODULE_VERSION(HPSA_DRIVER_VERSION);
MODULE_LICENSE("GPL");
-static int hpsa_allow_any;
-module_param(hpsa_allow_any, int, S_IRUGO|S_IWUSR);
+static bool hpsa_allow_any = false;
+static bool hpsa_claimed_unsupported = false;
+static int hpsa_set_hpsa_allow_any(const char *buffer,
+ const struct kernel_param *kp);
+static struct kernel_param_ops hpsa_allow_any_ops = {
+ .set = hpsa_set_hpsa_allow_any,
+ .get = param_get_bool,
+};
+
+module_param_cb(hpsa_allow_any, &hpsa_allow_any_ops, &hpsa_allow_any,
+ S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(hpsa_allow_any,
- "Allow hpsa driver to access unknown HP Smart Array hardware");
+ "Allow hpsa driver to access unsupported HP Smart Array hardware");
static int hpsa_simple_mode;
module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(hpsa_simple_mode,
@@ -7302,10 +7311,12 @@ static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id,
!hpsa_allow_any) {
dev_warn(&pdev->dev, "unrecognized board ID: "
"0x%08x, ignoring.\n", *board_id);
+ dev_warn(&pdev->dev, "This device may be enabled by loading the hpsa module with the hpsa_allow_any=1 option or by writing \"%s\" to /sys/bus/pci/drivers/hpsa/bind while the module is loaded. Please note that the driver is untested with this device and will result in an unsupported environment.\n", dev_name(&pdev->dev));
return -ENODEV;
}
if (supported)
*supported = false;
+ hpsa_claimed_unsupported = true;
return ARRAY_SIZE(products) - 1; /* generic unknown smart array */
}
@@ -9622,5 +9633,31 @@ static void __attribute__((unused)) verify_offsets(void)
#undef VERIFY_OFFSET
}
+static int hpsa_set_hpsa_allow_any(const char *buffer,
+ const struct kernel_param *kp)
+{
+ int ret;
+ struct kernel_param dummy_kp = *kp;
+ bool newval;
+
+ dummy_kp.arg = &newval;
+
+ ret = param_set_bool(buffer, &dummy_kp);
+ if (ret)
+ return ret;
+
+ if (hpsa_allow_any && !newval) {
+ if (hpsa_claimed_unsupported) {
+ pr_info("hpsa: can't disable hpsa_allow_any parameter. Devices already in use.\n");
+ return -EPERM;
+ } else
+ hpsa_allow_any = false;
+ } else if (!hpsa_allow_any && newval) {
+ pr_info("hpsa: allowing unsupported devices. If devices are claimed, this will result in an unsupported environment.\n");
+ hpsa_allow_any = true;
+ }
+ return 0;
+}
+
module_init(hpsa_init);
module_exit(hpsa_cleanup);
--
1.8.5.6
next prev parent reply other threads:[~2017-08-08 8:35 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-08 8:35 [PATCH RESEND 0/6] hpsa: support legacy boards Hannes Reinecke
2017-08-08 8:35 ` [PATCH 1/6] hpsa: consolidate status variables Hannes Reinecke
2017-08-09 13:40 ` Christoph Hellwig
2017-08-14 10:02 ` Hannes Reinecke
2017-08-08 8:35 ` [PATCH 2/6] hpsa: add support for legacy boards Hannes Reinecke
2017-08-09 13:41 ` Christoph Hellwig
2017-08-09 15:08 ` Hannes Reinecke
2017-08-09 15:59 ` Christoph Hellwig
2017-08-09 13:45 ` Christoph Hellwig
2017-08-09 14:50 ` Hannes Reinecke
2017-08-08 8:35 ` [PATCH 3/6] hpsa: disable volume status check for older controller Hannes Reinecke
2017-08-09 13:42 ` Christoph Hellwig
2017-08-11 13:23 ` Tomas Henzl
2017-08-14 10:45 ` Hannes Reinecke
2017-08-08 8:35 ` [PATCH 4/6] hpsa: Ignore errors for unsupported LV_DEVICE_ID VPD page Hannes Reinecke
2017-08-09 13:45 ` Christoph Hellwig
2017-08-08 8:35 ` [PATCH 5/6] hpsa: do not print errors for unsupported report luns format Hannes Reinecke
2017-08-09 13:46 ` Christoph Hellwig
2017-08-09 14:52 ` Hannes Reinecke
2017-08-08 8:35 ` Hannes Reinecke [this message]
2017-08-09 13:48 ` [PATCH 6/6] hpsa: handle unsupported devices more gracefully Christoph Hellwig
2017-08-09 22:08 ` [PATCH RESEND 0/6] hpsa: support legacy boards Don Brace
2017-08-10 7:07 ` Hannes Reinecke
2017-08-10 7:09 ` Christoph Hellwig
2017-08-10 7:29 ` Hannes Reinecke
2017-08-10 14:06 ` James Bottomley
2017-08-10 14:11 ` Hannes Reinecke
2017-08-10 19:15 ` Don Brace
2017-08-11 6:43 ` Hannes Reinecke
2017-08-11 16:35 ` Don Brace
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=1502181315-102499-7-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=don.brace@microsemi.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=jeffm@suse.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mroos@linux.ee \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.