Date: Sat, 21 Feb 2009 16:39:27 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r188897 - head/sys/dev/ata Message-ID: <200902211639.n1LGdRVK070622@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Sat Feb 21 16:39:26 2009 New Revision: 188897 URL: http://svn.freebsd.org/changeset/base/188897 Log: Teach device drivers' ata_reinit() methods, that there can be more then two devices per channel. Modified: head/sys/dev/ata/ata-disk.c head/sys/dev/ata/atapi-cd.c head/sys/dev/ata/atapi-fd.c head/sys/dev/ata/atapi-tape.c Modified: head/sys/dev/ata/ata-disk.c ============================================================================== --- head/sys/dev/ata/ata-disk.c Sat Feb 21 15:40:03 2009 (r188896) +++ head/sys/dev/ata/ata-disk.c Sat Feb 21 16:39:26 2009 (r188897) @@ -199,10 +199,9 @@ ad_reinit(device_t dev) struct ata_device *atadev = device_get_softc(dev); /* if detach pending, return error */ - if (((atadev->unit == ATA_MASTER) && !(ch->devices & ATA_ATA_MASTER)) || - ((atadev->unit == ATA_SLAVE) && !(ch->devices & ATA_ATA_SLAVE))) { + if (!(ch->devices & (ATA_ATA_MASTER << atadev->unit))) return 1; - } + ad_init(dev); return 0; } Modified: head/sys/dev/ata/atapi-cd.c ============================================================================== --- head/sys/dev/ata/atapi-cd.c Sat Feb 21 15:40:03 2009 (r188896) +++ head/sys/dev/ata/atapi-cd.c Sat Feb 21 16:39:26 2009 (r188897) @@ -159,10 +159,10 @@ acd_reinit(device_t dev) struct ata_channel *ch = device_get_softc(device_get_parent(dev)); struct ata_device *atadev = device_get_softc(dev); - if (((atadev->unit == ATA_MASTER) && !(ch->devices & ATA_ATAPI_MASTER)) || - ((atadev->unit == ATA_SLAVE) && !(ch->devices & ATA_ATAPI_SLAVE))) { - return 1; - } + /* if detach pending, return error */ + if (!(ch->devices & (ATA_ATAPI_MASTER << atadev->unit))) + return 1; + ATA_SETMODE(device_get_parent(dev), dev); return 0; } Modified: head/sys/dev/ata/atapi-fd.c ============================================================================== --- head/sys/dev/ata/atapi-fd.c Sat Feb 21 15:40:03 2009 (r188896) +++ head/sys/dev/ata/atapi-fd.c Sat Feb 21 16:39:26 2009 (r188897) @@ -147,11 +147,11 @@ afd_reinit(device_t dev) { struct ata_channel *ch = device_get_softc(device_get_parent(dev)); struct ata_device *atadev = device_get_softc(dev); - - if (((atadev->unit == ATA_MASTER) && !(ch->devices & ATA_ATAPI_MASTER)) || - ((atadev->unit == ATA_SLAVE) && !(ch->devices & ATA_ATAPI_SLAVE))) { + + /* if detach pending, return error */ + if (!(ch->devices & (ATA_ATAPI_MASTER << atadev->unit))) return 1; - } + ATA_SETMODE(device_get_parent(dev), dev); return 0; } Modified: head/sys/dev/ata/atapi-tape.c ============================================================================== --- head/sys/dev/ata/atapi-tape.c Sat Feb 21 15:40:03 2009 (r188896) +++ head/sys/dev/ata/atapi-tape.c Sat Feb 21 16:39:26 2009 (r188897) @@ -191,10 +191,10 @@ ast_reinit(device_t dev) struct ata_channel *ch = device_get_softc(device_get_parent(dev)); struct ata_device *atadev = device_get_softc(dev); - if (((atadev->unit == ATA_MASTER) && !(ch->devices & ATA_ATAPI_MASTER)) || - ((atadev->unit == ATA_SLAVE) && !(ch->devices & ATA_ATAPI_SLAVE))) { + /* if detach pending, return error */ + if (!(ch->devices & (ATA_ATAPI_MASTER << atadev->unit))) return 1; - } + ATA_SETMODE(device_get_parent(dev), dev); return 0; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902211639.n1LGdRVK070622>