NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/53389: ataraid doesn't work without _MODULE



The following reply was made to PR kern/53389; it has been noted by GNATS.

From: Paul Goyette <paul%whooppee.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: kern-bug-people%netbsd.org@localhost
Subject: Re: kern/53389: ataraid doesn't work without _MODULE
Date: Fri, 22 Jun 2018 15:05:42 +0800 (+08)

 Can you please try the following patch _instead of_ your suggestion?
 
 This patch calls config_cfattach_attach() in the ataraid_modcmd() code 
 whether or not it is built as a module, and avoids duplication of the 
 call.  This version also handles the MODULE_FINI situation which can 
 occur if a built-in module is explicitly disabled via modctl(8).
 
 
 Index: ata_raid.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ata/ata_raid.c,v
 retrieving revision 1.39
 diff -u -p -r1.39 ata_raid.c
 --- ata_raid.c	27 Sep 2016 08:05:34 -0000	1.39
 +++ ata_raid.c	22 Jun 2018 07:03:08 -0000
 @@ -338,26 +338,27 @@ ataraid_modcmd(modcmd_t cmd, void *arg)
   		error = config_cfdriver_attach(&ataraid_cd);
   		if (error)
   			break;
 +#endif
 
   		error = config_cfattach_attach(ataraid_cd.cd_name, &ataraid_ca);
   		if (error) {
 +#ifdef _MODULE
   			config_cfdriver_detach(&ataraid_cd);
 +#endif
   			aprint_error("%s: unable to register cfattach for \n"
   			    "%s, error %d", __func__, ataraid_cd.cd_name,
   			    error);
   			break;
   		}
 -#endif
   		break;
   	case MODULE_CMD_FINI:
 -#ifdef _MODULE
 -
   		error = config_cfattach_detach(ataraid_cd.cd_name, &ataraid_ca);
   		if (error) {
   			aprint_error("%s: failed to detach %s cfattach, "
   			    "error %d\n", __func__, ataraid_cd.cd_name, error);
   			break;
   		}
 +#ifdef _MODULE
   		error = config_cfdriver_detach(&ataraid_cd);
   		if (error) {
   			(void)config_cfattach_attach(ataraid_cd.cd_name,
 
 
 
 +------------------+--------------------------+----------------------------+
 | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
 | (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
 | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
 +------------------+--------------------------+----------------------------+
 


Home | Main Index | Thread Index | Old Index