Author: ian
Date: Sun Mar 10 18:48:08 2019
New Revision: 344981
URL: https://svnweb.freebsd.org/changeset/base/344981

Log:
  Give the mx25l device sole ownership of the name /dev/flash/spi* instead of
  trying to use disk_add_alias() to make spi* an alias for mx25l*.  It turns
  out disk_add_alias() works for partitions, but not slices, and that's hard
  to fix.
  
  This change is, in effect, a partial revert of r344526.
  
  The mips world relies on the existence of flashmap names formatted as
  /dev/flash/spi0s.name, whereas pretty much nothing relies on at45d devices
  using the /dev/spi* names (because until recently the at45d driver didn't
  even work reliably). So this change makes mx25l devices the sole owner of
  the /dev/flash/spi* namespace, which actually makes some sense because it is
  a SpiFlash(tm) device, so flash/spi isn't a horrible name.
  
  Reported by:  Mori Hiroki <yamori...@yahoo.co.jp>

Modified:
  head/sys/dev/flash/at45d.c
  head/sys/dev/flash/mx25l.c

Modified: head/sys/dev/flash/at45d.c
==============================================================================
--- head/sys/dev/flash/at45d.c  Sun Mar 10 17:20:09 2019        (r344980)
+++ head/sys/dev/flash/at45d.c  Sun Mar 10 18:48:08 2019        (r344981)
@@ -381,7 +381,6 @@ at45d_delayed_attach(void *xsc)
        sc->disk->d_mediasize = pagesize * ident->pagecount;
        sc->disk->d_unit = device_get_unit(sc->dev);
        disk_create(sc->disk, DISK_VERSION);
-       disk_add_alias(sc->disk, "flash/spi");
        bioq_init(&sc->bio_queue);
        kproc_create(&at45d_task, sc, &sc->p, 0, 0, "task: at45d flash");
        sc->taskstate = TSTATE_RUNNING;

Modified: head/sys/dev/flash/mx25l.c
==============================================================================
--- head/sys/dev/flash/mx25l.c  Sun Mar 10 17:20:09 2019        (r344980)
+++ head/sys/dev/flash/mx25l.c  Sun Mar 10 18:48:08 2019        (r344981)
@@ -510,7 +510,7 @@ mx25l_attach(device_t dev)
        sc->sc_disk->d_strategy = mx25l_strategy;
        sc->sc_disk->d_getattr = mx25l_getattr;
        sc->sc_disk->d_ioctl = mx25l_ioctl;
-       sc->sc_disk->d_name = "flash/mx25l";
+       sc->sc_disk->d_name = "flash/spi";
        sc->sc_disk->d_drv1 = sc;
        sc->sc_disk->d_maxsize = DFLTPHYS;
        sc->sc_disk->d_sectorsize = MX25L_SECTORSIZE;
@@ -522,7 +522,6 @@ mx25l_attach(device_t dev)
            sizeof(sc->sc_disk->d_descr));
 
        disk_create(sc->sc_disk, DISK_VERSION);
-       disk_add_alias(sc->sc_disk, "flash/spi");
        bioq_init(&sc->sc_bio_queue);
 
        kproc_create(&mx25l_task, sc, &sc->sc_p, 0, 0, "task: mx25l flash");
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to