From owner-svn-src-head@freebsd.org Mon Feb 25 17:30:02 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A3B31510202; Mon, 25 Feb 2019 17:30:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 20DF36F990; Mon, 25 Feb 2019 17:30:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 119EF20238; Mon, 25 Feb 2019 17:30:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1PHU1Oi087320; Mon, 25 Feb 2019 17:30:01 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1PHU1a2087318; Mon, 25 Feb 2019 17:30:01 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201902251730.x1PHU1a2087318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 25 Feb 2019 17:30:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344526 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 344526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 20DF36F990 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Feb 2019 17:30:02 -0000 Author: ian Date: Mon Feb 25 17:30:01 2019 New Revision: 344526 URL: https://svnweb.freebsd.org/changeset/base/344526 Log: Resolve a name conflict when both SpiFlash and DataFlash devices are present. Both SpiFlash (mx25l) and DataFlash (at45d) drivers create a disk device with a name of /dev/flash/spiN where N is the driver's unit number. If both types of devices are present in the same system, this creates a fatal conflict that prevents attachment of whichever device attaches second (because mx25l0 and at45d0 both try to create a spi0). This gives each type of device a unique name (mx25lN or at45dN respectively) and also adds an alias of spiN for compatibility. When both device types appear in the same system, only the first to attach gets the spiN alias. When the second device attaches there is a non-fatal warning that the alias can't be created, but both devices are still accessible via their primary names (and there is no need for the spiN name to work for backwards compatibility on such a system, because it has never been possible to use the spiN names when both devices exist). 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 Mon Feb 25 16:40:10 2019 (r344525) +++ head/sys/dev/flash/at45d.c Mon Feb 25 17:30:01 2019 (r344526) @@ -338,13 +338,14 @@ at45d_delayed_attach(void *xsc) sc->disk->d_open = at45d_open; sc->disk->d_close = at45d_close; sc->disk->d_strategy = at45d_strategy; - sc->disk->d_name = "flash/spi"; + sc->disk->d_name = "flash/at45d"; sc->disk->d_drv1 = sc; sc->disk->d_maxsize = DFLTPHYS; sc->disk->d_sectorsize = pagesize; 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->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 Mon Feb 25 16:40:10 2019 (r344525) +++ head/sys/dev/flash/mx25l.c Mon Feb 25 17:30:01 2019 (r344526) @@ -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/spi"; + sc->sc_disk->d_name = "flash/mx25l"; sc->sc_disk->d_drv1 = sc; sc->sc_disk->d_maxsize = DFLTPHYS; sc->sc_disk->d_sectorsize = MX25L_SECTORSIZE; @@ -522,6 +522,7 @@ 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");