From nobody Fri Mar 25 19:25:16 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A10271A3114B; Fri, 25 Mar 2022 19:25:16 +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 4KQBrD3yz0z4gNQ; Fri, 25 Mar 2022 19:25:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648236316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YlJ9hnJJoubKSGiqikRpsMTgTZtswpFLNRiv00GhZ00=; b=e6WtpnJ1ExStba3/LM/g/HgZYT7qsseS9w40jHkh42tpljUJ3MsNvLdkeJGL82LcqBSOlP r1eZP3qRAUfazgtJ8IRP+MAabB5O8yk7RZWvs5q8fPXfXTFroaT6ANz1FZHR34ivj1Ue7i k02wzqhXbfW8OAe+Bw9/kY8YNBVDYj/fLsRkGiabBx209ep2l+WszphobZm98fgprOvcSj T4Bv3KRHIGdtWDrdVz3BDg3THfKFaTEctFS0OcTuohd3Xscsg2ZP+zwlnMp+iFp2OkmfBu Rtztxo7R9HpzgbcvFjNSItHqWXWAxX8U0w5uOrcUz1gqClXrVU7HLnWgEYgXrw== 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 64D7A12AA1; Fri, 25 Mar 2022 19:25:16 +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 22PJPGAW093808; Fri, 25 Mar 2022 19:25:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22PJPG0l093807; Fri, 25 Mar 2022 19:25:16 GMT (envelope-from git) Date: Fri, 25 Mar 2022 19:25:16 GMT Message-Id: <202203251925.22PJPG0l093807@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 2e8830678637 - main - rtsx: Remove update of softc during probe and some var rename. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2e8830678637f5c1757a228ceb2605387c6f97ef Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648236316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YlJ9hnJJoubKSGiqikRpsMTgTZtswpFLNRiv00GhZ00=; b=f2uHYFn0nshoxuDLsaHIw9732TZSOTx9K7X+afrIsimUnXzDPJDwKmgLYPuPS95g++JVbX 2H3MaKwGqL1SRfsuud5+qTh1fjT1JKfgFnpVcyXiawHDzy1GJF9DjuDucwtOis+I8IK4rA 1RfqysVup1cauYHGhENHkxF4U8s9Rh0hKuluNGl64g6kRUIDemYUMVfAQAohKelHrFSl0r j231Se4TYxo36/FyS9sT8NLeY448s9f/+YqPbjSVuP8xwbv8ndP1YpoOGER2wSKZq4dbRF ya7jIDjmHdjcDKJ4Zw8hShV926aPf7E0c/SNN0axNkfV3mfvqzqk6nuUARy22Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648236316; a=rsa-sha256; cv=none; b=RzGiybSejwwBdOvnUZUIhi6oIR+9t2KSfuIfiMs6SjhhjdcsazIGv0iUVOpjNNL2mzDevQ eMGNmmua80ps4VuNIaBhK+iMOKtxQ1yTSQN1b2VKOlyMwAcbw2i4UdAjiDQWBxGs3PecCf d12Hmu+k2M1JOVGk19G7pUxhl6HzJslsTb4669YP3COo6i7FcrDI/zTXL/s/vpGdyhesvH lJouKkEor3qinI4lxqAiFX+Mvik7jPqx3LPBQ/g/66PBO7aEyjqNUlvWhUCd+Dx3vHzbM8 EnpSUH+mSg0QI9esP68GLEOjgq3JgbmKhkYLdyt9buTptQPr1RElaPXKQFyEIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=2e8830678637f5c1757a228ceb2605387c6f97ef commit 2e8830678637f5c1757a228ceb2605387c6f97ef Author: Henri Hennebert AuthorDate: 2022-03-25 19:23:59 +0000 Commit: Alexander Motin CommitDate: 2022-03-25 19:24:49 +0000 rtsx: Remove update of softc during probe and some var rename. MFC after: 1 week --- sys/dev/rtsx/rtsx.c | 58 +++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/sys/dev/rtsx/rtsx.c b/sys/dev/rtsx/rtsx.c index 5664be67181f..88d7075c6ce1 100644 --- a/sys/dev/rtsx/rtsx.c +++ b/sys/dev/rtsx/rtsx.c @@ -97,10 +97,10 @@ struct rtsx_softc { rtsx_card_insert_task; /* card insert delayed task */ struct task rtsx_card_remove_task; /* card remove task */ - int rtsx_res_id; /* bus memory resource id */ - struct resource *rtsx_res; /* bus memory resource */ - bus_space_tag_t rtsx_btag; /* host register set tag */ - bus_space_handle_t rtsx_bhandle; /* host register set handle */ + int rtsx_mem_res_id; /* bus memory resource id */ + struct resource *rtsx_mem_res; /* bus memory resource */ + bus_space_tag_t rtsx_mem_btag; /* host register set tag */ + bus_space_handle_t rtsx_mem_bhandle; /* host register set handle */ bus_dma_tag_t rtsx_cmd_dma_tag; /* DMA tag for command transfer */ bus_dmamap_t rtsx_cmd_dmamap; /* DMA map for command transfer */ @@ -172,7 +172,7 @@ struct rtsx_softc { #define RTSX_RTL8411 0x5289 #define RTSX_RTL8411B 0x5287 -#define RTSX_VERSION "2.1f" +#define RTSX_VERSION "2.1f-1" static const struct rtsx_device { uint16_t vendor_id; @@ -320,9 +320,9 @@ static int rtsx_resume(device_t dev); #define ISSET(t, f) ((t) & (f)) #define READ4(sc, reg) \ - (bus_space_read_4((sc)->rtsx_btag, (sc)->rtsx_bhandle, (reg))) + (bus_space_read_4((sc)->rtsx_mem_btag, (sc)->rtsx_mem_bhandle, (reg))) #define WRITE4(sc, reg, val) \ - (bus_space_write_4((sc)->rtsx_btag, (sc)->rtsx_bhandle, (reg), (val))) + (bus_space_write_4((sc)->rtsx_mem_btag, (sc)->rtsx_mem_bhandle, (reg), (val))) #define RTSX_READ(sc, reg, val) \ do { \ @@ -3537,7 +3537,6 @@ rtsx_mmcbr_release_host(device_t bus, device_t child __unused) static int rtsx_probe(device_t dev) { - struct rtsx_softc *sc; uint16_t vendor_id; uint16_t device_id; int i; @@ -3551,8 +3550,6 @@ rtsx_probe(device_t dev) if (rtsx_devices[i].vendor_id == vendor_id && rtsx_devices[i].device_id == device_id) { device_set_desc(dev, rtsx_devices[i].desc); - sc = device_get_softc(dev); - sc->rtsx_device_id = device_id; result = BUS_PROBE_DEFAULT; break; } @@ -3568,6 +3565,8 @@ static int rtsx_attach(device_t dev) { struct rtsx_softc *sc = device_get_softc(dev); + uint16_t vendor_id; + uint16_t device_id; struct sysctl_ctx_list *ctx; struct sysctl_oid_list *tree; int msi_count = 1; @@ -3578,11 +3577,14 @@ rtsx_attach(device_t dev) char *product; int i; + vendor_id = pci_get_vendor(dev); + device_id = pci_get_device(dev); if (bootverbose) device_printf(dev, "Attach - Vendor ID: 0x%x - Device ID: 0x%x\n", - pci_get_vendor(dev), pci_get_device(dev)); + vendor_id, device_id); sc->rtsx_dev = dev; + sc->rtsx_device_id = device_id; sc->rtsx_req = NULL; sc->rtsx_timeout_cmd = 1; sc->rtsx_timeout_io = 10; @@ -3647,21 +3649,21 @@ rtsx_attach(device_t dev) /* Allocate memory resource. */ if (sc->rtsx_device_id == RTSX_RTS525A) - sc->rtsx_res_id = PCIR_BAR(1); + sc->rtsx_mem_res_id = PCIR_BAR(1); else - sc->rtsx_res_id = PCIR_BAR(0); - sc->rtsx_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rtsx_res_id, RF_ACTIVE); - if (sc->rtsx_res == NULL) { - device_printf(dev, "Can't allocate memory resource for %d\n", sc->rtsx_res_id); + sc->rtsx_mem_res_id = PCIR_BAR(0); + sc->rtsx_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rtsx_mem_res_id, RF_ACTIVE); + if (sc->rtsx_mem_res == NULL) { + device_printf(dev, "Can't allocate memory resource for %d\n", sc->rtsx_mem_res_id); goto destroy_rtsx_irq_res; } if (bootverbose) - device_printf(dev, "rtsx_irq_res_id: %d, rtsx_res_id: %d\n", - sc->rtsx_irq_res_id, sc->rtsx_res_id); + device_printf(dev, "rtsx_irq_res_id: %d, rtsx_mem_res_id: %d\n", + sc->rtsx_irq_res_id, sc->rtsx_mem_res_id); - sc->rtsx_btag = rman_get_bustag(sc->rtsx_res); - sc->rtsx_bhandle = rman_get_bushandle(sc->rtsx_res); + sc->rtsx_mem_btag = rman_get_bustag(sc->rtsx_mem_res); + sc->rtsx_mem_bhandle = rman_get_bushandle(sc->rtsx_mem_res); TIMEOUT_TASK_INIT(taskqueue_swi_giant, &sc->rtsx_card_insert_task, 0, rtsx_card_task, sc); @@ -3677,7 +3679,7 @@ rtsx_attach(device_t dev) NULL, rtsx_intr, sc, &sc->rtsx_irq_cookie); if (error) { device_printf(dev, "Can't set up irq [0x%x]!\n", error); - goto destroy_rtsx_res; + goto destroy_rtsx_mem_res; } pci_enable_busmaster(dev); @@ -3728,9 +3730,9 @@ rtsx_attach(device_t dev) destroy_rtsx_irq: bus_teardown_intr(dev, sc->rtsx_irq_res, sc->rtsx_irq_cookie); - destroy_rtsx_res: - bus_release_resource(dev, SYS_RES_MEMORY, sc->rtsx_res_id, - sc->rtsx_res); + destroy_rtsx_mem_res: + bus_release_resource(dev, SYS_RES_MEMORY, sc->rtsx_mem_res_id, + sc->rtsx_mem_res); rtsx_dma_free(sc); destroy_rtsx_irq_res: callout_drain(&sc->rtsx_timeout_callout); @@ -3750,7 +3752,7 @@ rtsx_detach(device_t dev) if (bootverbose) device_printf(dev, "Detach - Vendor ID: 0x%x - Device ID: 0x%x\n", - pci_get_vendor(dev), pci_get_device(dev)); + pci_get_vendor(dev), sc->rtsx_device_id); /* Disable interrupts. */ sc->rtsx_intr_enabled = 0; @@ -3767,9 +3769,9 @@ rtsx_detach(device_t dev) /* Teardown the state in our softc created in our attach routine. */ rtsx_dma_free(sc); - if (sc->rtsx_res != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, sc->rtsx_res_id, - sc->rtsx_res); + if (sc->rtsx_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, sc->rtsx_mem_res_id, + sc->rtsx_mem_res); if (sc->rtsx_irq_cookie != NULL) bus_teardown_intr(dev, sc->rtsx_irq_res, sc->rtsx_irq_cookie); if (sc->rtsx_irq_res != NULL) {