From owner-dev-commits-src-all@freebsd.org Mon Jun 28 22:24:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 067AB65DA1C; Mon, 28 Jun 2021 22:24:05 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GDMb86dbDz4kCb; Mon, 28 Jun 2021 22:24:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEFC856F3; Mon, 28 Jun 2021 22:24:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15SMO4HM048798; Mon, 28 Jun 2021 22:24:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15SMO4IU048797; Mon, 28 Jun 2021 22:24:04 GMT (envelope-from git) Date: Mon, 28 Jun 2021 22:24:04 GMT Message-Id: <202106282224.15SMO4IU048797@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: fdd60a97dad5 - main - sdiob: get the device_t from periph's path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fdd60a97dad5a0e81905a5d97cbc4b496638b06f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2021 22:24:05 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=fdd60a97dad5a0e81905a5d97cbc4b496638b06f commit fdd60a97dad5a0e81905a5d97cbc4b496638b06f Author: Warner Losh AuthorDate: 2021-06-28 22:00:09 +0000 Commit: Warner Losh CommitDate: 2021-06-28 22:13:02 +0000 sdiob: get the device_t from periph's path Use the new xpt_path_device to get the device_t using the periph's path. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30855 --- sys/dev/sdio/sdiob.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/sys/dev/sdio/sdiob.c b/sys/dev/sdio/sdiob.c index afa111971bf5..6209aa1f242e 100644 --- a/sys/dev/sdio/sdiob.c +++ b/sys/dev/sdio/sdiob.c @@ -112,7 +112,7 @@ struct sdiob_softc { #define NB_STATE_SIM_ADDED 0x0002 #define NB_STATE_READY 0x0004 - /* CAM side (including sim_dev). */ + /* CAM side. */ struct card_info cardinfo; struct cam_periph *periph; union ccb *ccb; @@ -923,23 +923,21 @@ sdio_newbus_sim_add(struct sdiob_softc *sc) /* Add ourselves to our parent (SIM) device. */ /* Add ourselves to our parent. That way we can become a parent. */ - KASSERT(sc->periph->sim->sim_dev != NULL, ("%s: sim_dev is NULL, sc %p " - "periph %p sim %p\n", __func__, sc, sc->periph, sc->periph->sim)); + pdev = xpt_path_sim_device(sc->periph->path); + KASSERT(pdev != NULL, + ("%s: pdev is NULL, sc %p periph %p sim %p\n", + __func__, sc, sc->periph, sc->periph->sim)); if (sc->dev == NULL) - sc->dev = BUS_ADD_CHILD(sc->periph->sim->sim_dev, 0, - SDIOB_NAME_S, -1); + sc->dev = BUS_ADD_CHILD(pdev, 0, SDIOB_NAME_S, -1); if (sc->dev == NULL) return (ENXIO); device_set_softc(sc->dev, sc); + /* * Don't set description here; devclass_add_driver() -> * device_probe_child() -> device_set_driver() will nuke it again. */ - - pdev = device_get_parent(sc->dev); - KASSERT(pdev != NULL, ("%s: sc %p dev %p (%s) parent is NULL\n", - __func__, sc, sc->dev, device_get_nameunit(sc->dev))); bus_devclass = device_get_devclass(pdev); if (bus_devclass == NULL) { printf("%s: Failed to get devclass from %s.\n", __func__, @@ -1032,9 +1030,8 @@ sdiobregister(struct cam_periph *periph, void *arg) __func__, periph); return(CAM_REQ_CMP_ERR); } - if (periph->sim == NULL || periph->sim->sim_dev == NULL) { - printf("%s: no sim %p or sim_dev %p\n", __func__, periph->sim, - (periph->sim != NULL) ? periph->sim->sim_dev : NULL); + if (xpt_path_sim_device(periph->path) == NULL) { + printf("%s: no device_t for sim %p\n", __func__, periph->sim); return(CAM_REQ_CMP_ERR); }