aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl/ctl_frontend_ioctl.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2017-01-21 19:38:26 +0000
committerAlexander Motin <mav@FreeBSD.org>2017-01-21 19:38:26 +0000
commit0c629e2884b5fd625155722bad18754e9f95451c (patch)
tree940575571a1e4126fd778e21f3d7d33c04c254f2 /sys/cam/ctl/ctl_frontend_ioctl.c
parent829857c8937044bbba611072bea9670788df3f75 (diff)
downloadsrc-0c629e2884b5fd625155722bad18754e9f95451c.tar.gz
src-0c629e2884b5fd625155722bad18754e9f95451c.zip
Add initial support for CTL module unloading.
It is only a first step and not perfect, but better then nothing. The main blocker is CAM target frontend, that can not be unloaded, since CAM does not have mechanism to unregister periph driver now. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=312603
Diffstat (limited to 'sys/cam/ctl/ctl_frontend_ioctl.c')
-rw-r--r--sys/cam/ctl/ctl_frontend_ioctl.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/cam/ctl/ctl_frontend_ioctl.c b/sys/cam/ctl/ctl_frontend_ioctl.c
index 3f5c23c0c55e..4063c97392df 100644
--- a/sys/cam/ctl/ctl_frontend_ioctl.c
+++ b/sys/cam/ctl/ctl_frontend_ioctl.c
@@ -76,7 +76,7 @@ struct cfi_softc {
static struct cfi_softc cfi_softc;
static int cfi_init(void);
-static void cfi_shutdown(void);
+static int cfi_shutdown(void);
static void cfi_datamove(union ctl_io *io);
static void cfi_done(union ctl_io *io);
@@ -93,6 +93,7 @@ cfi_init(void)
{
struct cfi_softc *isoftc = &cfi_softc;
struct ctl_port *port;
+ int error = 0;
memset(isoftc, 0, sizeof(*isoftc));
@@ -108,24 +109,25 @@ cfi_init(void)
port->targ_port = -1;
port->max_initiators = 1;
- if (ctl_port_register(port) != 0) {
+ if ((error = ctl_port_register(port)) != 0) {
printf("%s: ioctl port registration failed\n", __func__);
- return (0);
+ return (error);
}
ctl_port_online(port);
return (0);
}
-void
+static int
cfi_shutdown(void)
{
struct cfi_softc *isoftc = &cfi_softc;
- struct ctl_port *port;
+ struct ctl_port *port = &isoftc->port;
+ int error = 0;
- port = &isoftc->port;
ctl_port_offline(port);
- if (ctl_port_deregister(&isoftc->port) != 0)
- printf("%s: ctl_frontend_deregister() failed\n", __func__);
+ if ((error = ctl_port_deregister(port)) != 0)
+ printf("%s: ioctl port deregistration failed\n", __func__);
+ return (error);
}
/*