* [PATCH] add platform check to a couple sn2-only drivers
@ 2006-07-28 14:36 Greg Edwards
2006-07-28 14:50 ` Christoph Hellwig
2006-07-28 15:03 ` Greg Edwards
0 siblings, 2 replies; 3+ messages in thread
From: Greg Edwards @ 2006-07-28 14:36 UTC (permalink / raw)
To: linux-ia64
Non-sn2 boxes occasionally run into problems when they execute module_init
functions for sn2 drivers, if those drivers go off and try to read a
register that doesn't exist, or maybe dereference a variable that isn't
defined for the non-sn2 case.
This patch adds a platform check for the ioc4 and snsc driver init
functions. It's a bit overkill for the ioc4 case, but erring on the
conservative side doesn't hurt.
Signed-off-by: Greg Edwards <edwardsg@sgi.com>
---
drivers/char/snsc.c | 7 ++++++-
drivers/sn/ioc4.c | 3 +++
2 files changed, 9 insertions(+), 1 deletion(-)
Index: git-linus/drivers/char/snsc.c
=================================--- git-linus.orig/drivers/char/snsc.c 2006-07-27 09:15:02.524672764 -0500
+++ git-linus/drivers/char/snsc.c 2006-07-27 09:15:13.630016184 -0500
@@ -374,7 +374,12 @@ scdrv_init(void)
struct sysctl_data_s *scd;
void *salbuf;
dev_t first_dev, dev;
- nasid_t event_nasid = ia64_sn_get_console_nasid();
+ nasid_t event_nasid;
+
+ if (!ia64_platform_is("sn2"))
+ return -ENODEV;
+
+ event_nasid = ia64_sn_get_console_nasid();
if (alloc_chrdev_region(&first_dev, 0, num_cnodes,
SYSCTL_BASENAME) < 0) {
Index: git-linus/drivers/sn/ioc4.c
=================================--- git-linus.orig/drivers/sn/ioc4.c 2006-07-27 09:29:41.000000000 -0500
+++ git-linus/drivers/sn/ioc4.c 2006-07-27 09:54:49.186272223 -0500
@@ -455,6 +455,9 @@ MODULE_DEVICE_TABLE(pci, ioc4_id_table);
static int __devinit
ioc4_init(void)
{
+ if (!ia64_platform_is("sn2"))
+ return -ENODEV;
+
return pci_register_driver(&ioc4_driver);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] add platform check to a couple sn2-only drivers
2006-07-28 14:36 [PATCH] add platform check to a couple sn2-only drivers Greg Edwards
@ 2006-07-28 14:50 ` Christoph Hellwig
2006-07-28 15:03 ` Greg Edwards
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2006-07-28 14:50 UTC (permalink / raw)
To: linux-ia64
On Fri, Jul 28, 2006 at 09:36:26AM -0500, Greg Edwards wrote:
> - nasid_t event_nasid = ia64_sn_get_console_nasid();
> + nasid_t event_nasid;
> +
> + if (!ia64_platform_is("sn2"))
> + return -ENODEV;
> +
> + event_nasid = ia64_sn_get_console_nasid();
this one is okay and required.
> static int __devinit
> ioc4_init(void)
> {
> + if (!ia64_platform_is("sn2"))
> + return -ENODEV;
> +
this one not. The pci id matching will take care of things.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] add platform check to a couple sn2-only drivers
2006-07-28 14:36 [PATCH] add platform check to a couple sn2-only drivers Greg Edwards
2006-07-28 14:50 ` Christoph Hellwig
@ 2006-07-28 15:03 ` Greg Edwards
1 sibling, 0 replies; 3+ messages in thread
From: Greg Edwards @ 2006-07-28 15:03 UTC (permalink / raw)
To: linux-ia64
On Fri, Jul 28, 2006 at 03:50:22PM +0100, Christoph Hellwig wrote:
| On Fri, Jul 28, 2006 at 09:36:26AM -0500, Greg Edwards wrote:
| > - nasid_t event_nasid = ia64_sn_get_console_nasid();
| > + nasid_t event_nasid;
| > +
| > + if (!ia64_platform_is("sn2"))
| > + return -ENODEV;
| > +
| > + event_nasid = ia64_sn_get_console_nasid();
|
| this one is okay and required.
|
| > static int __devinit
| > ioc4_init(void)
| > {
| > + if (!ia64_platform_is("sn2"))
| > + return -ENODEV;
| > +
|
| this one not. The pci id matching will take care of things.
Ok, thanks Christoph. Brent brought that up, too, but we had been
burned by thinking we had it covered before on other drivers.
Tony, revised patch below.
Add a platform check to the snsc driver init function, to prevent
loading on non-sn2 systems.
Signed-off-by: Greg Edwards <edwardsg@sgi.com>
---
drivers/char/snsc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Index: git-linus/drivers/char/snsc.c
=================================--- git-linus.orig/drivers/char/snsc.c 2006-07-28 09:58:08.167283230 -0500
+++ git-linus/drivers/char/snsc.c 2006-07-28 09:58:45.095703646 -0500
@@ -374,7 +374,12 @@ scdrv_init(void)
struct sysctl_data_s *scd;
void *salbuf;
dev_t first_dev, dev;
- nasid_t event_nasid = ia64_sn_get_console_nasid();
+ nasid_t event_nasid;
+
+ if (!ia64_platform_is("sn2"))
+ return -ENODEV;
+
+ event_nasid = ia64_sn_get_console_nasid();
if (alloc_chrdev_region(&first_dev, 0, num_cnodes,
SYSCTL_BASENAME) < 0) {
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-07-28 15:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-28 14:36 [PATCH] add platform check to a couple sn2-only drivers Greg Edwards
2006-07-28 14:50 ` Christoph Hellwig
2006-07-28 15:03 ` Greg Edwards
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox