Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/spi Stash the device_t in spi_softc.



details:   https://anonhg.NetBSD.org/src/rev/9225f78cac11
branches:  trunk
changeset: 359733:9225f78cac11
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Jan 19 12:58:06 2022 +0000

description:
Stash the device_t in spi_softc.

diffstat:

 sys/dev/spi/spi.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (57 lines):

diff -r de79886e9ccd -r 9225f78cac11 sys/dev/spi/spi.c
--- a/sys/dev/spi/spi.c Wed Jan 19 10:30:04 2022 +0000
+++ b/sys/dev/spi/spi.c Wed Jan 19 12:58:06 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spi.c,v 1.21 2022/01/19 09:30:11 martin Exp $ */
+/* $NetBSD: spi.c,v 1.22 2022/01/19 12:58:06 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.21 2022/01/19 09:30:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.22 2022/01/19 12:58:06 thorpej Exp $");
 
 #include "locators.h"
 
@@ -62,6 +62,7 @@
 #include "locators.h"
 
 struct spi_softc {
+       device_t                sc_dev;
        struct spi_controller   sc_controller;
        int                     sc_mode;
        int                     sc_speed;
@@ -291,6 +292,7 @@
        mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM);
        cv_init(&sc->sc_cv, "spictl");
 
+       sc->sc_dev = self;
        sc->sc_controller = *sba->sba_controller;
        sc->sc_nslaves = sba->sba_controller->sct_nslaves;
        /* allocate slave structures */
@@ -341,7 +343,6 @@
 spi_ioctl(dev_t dev, u_long cmd, void *data, int flag, lwp_t *l)
 {
        struct spi_softc *sc = device_lookup_private(&spi_cd, minor(dev));
-       device_t self = device_lookup(&spi_cd, minor(dev));
        struct spi_handle *sh;
        spi_ioctl_configure_t *sic;
        spi_ioctl_transfer_t *sit;
@@ -361,7 +362,8 @@
                        break;
                }
                sh = &sc->sc_slaves[sic->sic_addr];
-               error = spi_configure(self, sh, sic->sic_mode, sic->sic_speed);
+               error = spi_configure(sc->sc_dev, sh, sic->sic_mode,
+                   sic->sic_speed);
                break;
        case SPI_IOCTL_TRANSFER:
                sit = (spi_ioctl_transfer_t *)data;
@@ -670,4 +672,3 @@
 
        return 0;
 }
-



Home | Main Index | Thread Index | Old Index