Date: Wed, 4 Oct 2006 00:18:27 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 107229 for review Message-ID: <200610040018.k940IR4n049264@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=107229 Change 107229 by imp@imp_lighthouse on 2006/10/04 00:17:41 Fix broken locking. simplify a open/close. Affected files ... .. //depot/projects/arm/src/sys/dev/mmc/mmcsd.c#8 edit Differences ... ==== //depot/projects/arm/src/sys/dev/mmc/mmcsd.c#8 (text+ko) ==== @@ -89,7 +89,6 @@ sc->dev = dev; MMCSD_LOCK_INIT(sc); - MMCSD_LOCK(sc); sc->disk = disk_alloc(); sc->disk->d_open = mmcsd_open; sc->disk->d_close = mmcsd_close; @@ -103,7 +102,6 @@ sc->disk->d_unit = device_get_unit(dev); disk_create(sc->disk, DISK_VERSION); bioq_init(&sc->bio_queue); - MMCSD_UNLOCK(sc); kthread_create(&mmcsd_task, sc, &sc->p, 0, 0, "task: mmc/sd card"); return (0); @@ -118,27 +116,12 @@ static int mmcsd_open(struct disk *dp) { - struct mmcsd_softc *sc; - - sc = (struct mmcsd_softc *)dp->d_drv1; - - MMCSD_LOCK(sc); - MMCSD_UNLOCK(sc); - return 0; } static int mmcsd_close(struct disk *dp) { - struct mmcsd_softc *sc; - - sc = (struct mmcsd_softc *)dp->d_drv1; - - MMCSD_LOCK(sc); - MMCSD_UNLOCK(sc); - - // XXX do nothing since we don't lock for now return 0; } @@ -168,17 +151,17 @@ uint32_t block; device_t dev; - MMCSD_LOCK(sc); - printf("mmcsd_task: start\n"); dev = sc->dev; for (;;) { + MMCSD_LOCK(sc); do { bp = bioq_first(&sc->bio_queue); if (bp == NULL) msleep(sc, &sc->sc_mtx, PRIBIO, "jobqueue", 0); } while (bp == NULL); + bioq_remove(&sc->bio_queue, bp); + MMCSD_UNLOCK(sc); MMCBUS_ACQUIRE_BUS(device_get_parent(dev), dev); - bioq_remove(&sc->bio_queue, bp); // printf("mmc_task: request %p for block %lld\n", bp, bp->bio_pblkno); sz = sc->disk->d_sectorsize; end = bp->bio_pblkno + (bp->bio_bcount / sz);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610040018.k940IR4n049264>