Provide a default setmode method.

This shaves off multiple copies of the same setmode stub.
This commit is contained in:
sos 2005-04-28 22:15:44 +00:00
parent 1b3db0634d
commit 59b35c0698
4 changed files with 9 additions and 36 deletions

View File

@ -152,15 +152,6 @@ ata_pccard_detach(device_t dev)
return 0;
}
static void
ata_pccard_setmode(device_t parent, device_t dev)
{
struct ata_device *atadev = device_get_softc(dev);
int mode = atadev->mode;
atadev->mode = ata_limit_mode(atadev, mode, ATA_PIO_MAX);
}
static device_method_t ata_pccard_methods[] = {
/* device interface */
DEVMETHOD(device_probe, pccard_compat_probe),
@ -172,8 +163,6 @@ static device_method_t ata_pccard_methods[] = {
DEVMETHOD(card_compat_probe, ata_pccard_probe),
DEVMETHOD(card_compat_attach, ata_attach),
/* ATA methods */
DEVMETHOD(ata_setmode, ata_pccard_setmode),
{ 0, 0 }
};

View File

@ -328,15 +328,6 @@ ata_cbuschannel_banking(device_t dev, int flags)
return res;
}
static void
ata_cbus_setmode(device_t parent, device_t dev)
{
struct ata_device *atadev = device_get_softc(dev);
int mode = atadev->mode;
atadev->mode = ata_limit_mode(atadev, mode, ATA_PIO_MAX);
}
static device_method_t ata_cbuschannel_methods[] = {
/* device interface */
DEVMETHOD(device_probe, ata_cbuschannel_probe),
@ -347,7 +338,6 @@ static device_method_t ata_cbuschannel_methods[] = {
/* ATA methods */
DEVMETHOD(ata_locking, ata_cbuschannel_banking),
DEVMETHOD(ata_setmode, ata_cbus_setmode),
{ 0, 0 }
};

View File

@ -108,16 +108,6 @@ ata_isa_probe(device_t dev)
return ata_probe(dev);
}
static void
ata_isa_setmode(device_t parent, device_t dev)
{
struct ata_device *atadev = device_get_softc(dev);
int mode = atadev->mode;
atadev->mode = ata_limit_mode(atadev, mode, ATA_PIO_MAX);
}
static device_method_t ata_isa_methods[] = {
/* device interface */
DEVMETHOD(device_probe, ata_isa_probe),
@ -125,8 +115,6 @@ static device_method_t ata_isa_methods[] = {
DEVMETHOD(device_suspend, ata_suspend),
DEVMETHOD(device_resume, ata_resume),
/* ATA methods */
DEVMETHOD(ata_setmode, ata_isa_setmode),
{ 0, 0 }
};

View File

@ -58,10 +58,18 @@ HEADER {
#define ATA_LF_WHICH 0x0004
};
CODE {
static void ata_null_setmode(device_t parent, device_t dev)
{
struct ata_device *atadev = device_get_softc(dev);
atadev->mode = ata_limit_mode(atadev, atadev->mode, ATA_PIO_MAX);
}
};
METHOD void setmode {
device_t channel;
device_t dev;
};
} DEFAULT ata_null_setmode;;
METHOD void reset {
device_t channel;
@ -70,5 +78,3 @@ METHOD void reset {
METHOD int reinit {
device_t dev;
};