These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / block / paride / pf.c
index 9a15fd3..7a7d977 100644 (file)
@@ -264,6 +264,7 @@ static int pf_cmd;          /* current command READ/WRITE */
 static struct pf_unit *pf_current;/* unit of current request */
 static int pf_mask;            /* stopper for pseudo-int */
 static char *pf_buf;           /* buffer for request in progress */
+static void *par_drv;          /* reference of parport driver */
 
 /* kernel glue structures */
 
@@ -703,6 +704,11 @@ static int pf_detect(void)
        printk("%s: %s version %s, major %d, cluster %d, nice %d\n",
               name, name, PF_VERSION, major, cluster, nice);
 
+       par_drv = pi_register_driver(name);
+       if (!par_drv) {
+               pr_err("failed to register %s driver\n", name);
+               return -1;
+       }
        k = 0;
        if (pf_drive_count == 0) {
                if (pi_init(pf->pi, 1, -1, -1, -1, -1, -1, pf_scratch, PI_PF,
@@ -735,6 +741,7 @@ static int pf_detect(void)
        printk("%s: No ATAPI disk detected\n", name);
        for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++)
                put_disk(pf->disk);
+       pi_unregister_driver(par_drv);
        return -1;
 }