From 68dd779577866b888068f58dd6673f8409022ccf Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Sun, 10 Mar 2019 18:48:08 +0000 Subject: [PATCH] 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 --- sys/dev/flash/at45d.c | 1 - sys/dev/flash/mx25l.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/dev/flash/at45d.c b/sys/dev/flash/at45d.c index 427eafae9418..6afe65911480 100644 --- a/sys/dev/flash/at45d.c +++ b/sys/dev/flash/at45d.c @@ -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; diff --git a/sys/dev/flash/mx25l.c b/sys/dev/flash/mx25l.c index b95fdcabbd4b..ffd2946062b8 100644 --- a/sys/dev/flash/mx25l.c +++ b/sys/dev/flash/mx25l.c @@ -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");