Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Jun 2021 19:08:39 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: cc384c67ce2b - main - cam: prefer cam_sim_softc() over accessing cam_sim structure directly.
Message-ID:  <202106031908.153J8dMG068685@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=cc384c67ce2b6b0b30e08a264d4ef9a116e70505

commit cc384c67ce2b6b0b30e08a264d4ef9a116e70505
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-06-03 19:05:20 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-06-03 19:08:29 +0000

    cam: prefer cam_sim_softc() over accessing cam_sim structure directly.
    
    Use the accessor function to get the softc for this sim. This also drops
    an unneeded cast.
    
    Sponsored by:           Netflix
    Reviewed by:            mav@, hselasky@
    Differential Revision:  https://reviews.freebsd.org/D30360
---
 sys/dev/firewire/sbp.c      | 4 ++--
 sys/dev/usb/storage/umass.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c
index 58e2086399d2..a161713a94ad 100644
--- a/sys/dev/firewire/sbp.c
+++ b/sys/dev/firewire/sbp.c
@@ -2273,7 +2273,7 @@ static void
 sbp_action(struct cam_sim *sim, union ccb *ccb)
 {
 
-	struct sbp_softc *sbp = (struct sbp_softc *)sim->softc;
+	struct sbp_softc *sbp = cam_sim_softc(sim);
 	struct sbp_target *target = NULL;
 	struct sbp_dev *sdev = NULL;
 
@@ -2632,7 +2632,7 @@ sbp_poll(struct cam_sim *sim)
 	struct sbp_softc *sbp;
 	struct firewire_comm *fc;
 
-	sbp = (struct sbp_softc *)sim->softc;
+	sbp = cam_sim_softc(sim);
 	fc = sbp->fd.fc;
 
 	fc->poll(fc, 0, -1);
diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c
index 8260226e5d12..bc07fe50b6ab 100644
--- a/sys/dev/usb/storage/umass.c
+++ b/sys/dev/usb/storage/umass.c
@@ -2157,7 +2157,7 @@ umass_cam_detach_sim(struct umass_softc *sc)
 static void
 umass_cam_action(struct cam_sim *sim, union ccb *ccb)
 {
-	struct umass_softc *sc = (struct umass_softc *)sim->softc;
+	struct umass_softc *sc = cam_sim_softc(sim);
 
 	if (sc == NULL) {
 		ccb->ccb_h.status = CAM_SEL_TIMEOUT;
@@ -2433,7 +2433,7 @@ done:
 static void
 umass_cam_poll(struct cam_sim *sim)
 {
-	struct umass_softc *sc = (struct umass_softc *)sim->softc;
+	struct umass_softc *sc = cam_sim_softc(sim);
 
 	if (sc == NULL)
 		return;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106031908.153J8dMG068685>