From 9f06a4277f1fe2bf66be975977b6170d40d47b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Mon, 25 Aug 2003 09:01:49 +0000 Subject: Unify prototypes. Cosmetics. --- sys/dev/ata/ata-all.c | 12 ++++----- sys/dev/ata/ata-all.h | 66 +++++++++++++++++++++++----------------------- sys/dev/ata/ata-card.c | 2 +- sys/dev/ata/ata-cbus.c | 11 ++++---- sys/dev/ata/ata-disk.c | 10 +++---- sys/dev/ata/ata-isa.c | 1 - sys/dev/ata/ata-lowlevel.c | 14 +++++----- sys/dev/ata/ata-queue.c | 6 ++--- sys/dev/ata/atapi-cd.c | 26 +++++++++--------- sys/dev/ata/atapi-fd.c | 6 ++--- sys/dev/ata/atapi-tape.c | 22 ++++++++++------ 11 files changed, 91 insertions(+), 85 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 0a66ec287a59..fa2d16f1bb44 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -65,13 +65,13 @@ static struct cdevsw ata_cdevsw = { }; /* prototypes */ -static void ata_shutdown(void *arg, int howto); -static int ata_getparam(struct ata_device *atadev, u_int8_t command); -static void ata_identify_devices(struct ata_channel *ch); +static void ata_shutdown(void *, int); +static int ata_getparam(struct ata_device *, u_int8_t); +static void ata_identify_devices(struct ata_channel *); static void ata_boot_attach(void); -static void bswap(int8_t *buf, int len); -static void btrim(int8_t *buf, int len); -static void bpack(int8_t *src, int8_t *dst, int len); +static void bswap(int8_t *, int); +static void btrim(int8_t *, int); +static void bpack(int8_t *, int8_t *, int); static void ata_init(void); /* sysctl vars */ diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h index 99ec220eddb9..a012e3ec498d 100644 --- a/sys/dev/ata/ata-all.h +++ b/sys/dev/ata/ata-all.h @@ -196,7 +196,7 @@ struct ata_request { #define ATA_R_REQUEUE 0x0400 #define ATA_R_SKIPSTART 0x0800 - void (*callback)(struct ata_request *); + void (*callback)(struct ata_request *request); int retries; /* retry count */ int timeout; /* timeout for this cmd */ struct callout_handle timeout_handle; /* handle for untimeout */ @@ -216,9 +216,9 @@ struct ata_device { char *name; /* device name */ struct ata_params *param; /* ata param structure */ void *softc; /* ptr to softc for device */ - void (*attach)(struct ata_device *); - void (*detach)(struct ata_device *); - void (*start)(struct ata_device *); + void (*attach)(struct ata_device *atadev); + void (*detach)(struct ata_device *atadev); + void (*start)(struct ata_device *atadev); int flags; #define ATA_D_USE_CHS 0x0001 #define ATA_D_DETACHING 0x0002 @@ -227,7 +227,7 @@ struct ata_device { int cmd; /* last cmd executed */ int mode; /* transfermode */ - void (*setmode)(struct ata_device *, int); + void (*setmode)(struct ata_device *atadev, int mode); }; /* structure for holding DMA address data */ @@ -251,18 +251,18 @@ struct ata_dma { #define ATA_DMA_ACTIVE 0x01 /* DMA transfer in progress */ #define ATA_DMA_READ 0x02 /* transaction is a read */ - int (*alloc)(struct ata_channel *); - void (*free)(struct ata_channel *); - int (*setup)(struct ata_device *, caddr_t, int32_t); - int (*start)(struct ata_channel *, caddr_t, int32_t, int); - int (*stop)(struct ata_channel *); + int (*alloc)(struct ata_channel *ch); + void (*free)(struct ata_channel *ch); + int (*setup)(struct ata_device *atadev, caddr_t data, int32_t count); + int (*start)(struct ata_channel *ch, caddr_t data, int32_t count, int dir); + int (*stop)(struct ata_channel *ch); }; /* structure holding lowlevel functions */ struct ata_lowlevel { - void (*reset)(struct ata_channel *); - int (*transaction)(struct ata_request *); - void (*interrupt)(void *); + void (*reset)(struct ata_channel *ch); + int (*transaction)(struct ata_request *request); + void (*interrupt)(void *channel); }; /* structure holding resources for an ATA channel */ @@ -347,19 +347,19 @@ extern int ata_dma, ata_wc, atapi_dma; /* public prototypes */ /* ata-all.c: */ -int ata_probe(device_t); -int ata_attach(device_t); -int ata_detach(device_t); -int ata_suspend(device_t); -int ata_resume(device_t); -int ata_printf(struct ata_channel *, int, const char *, ...) __printflike(3, 4); -int ata_prtdev(struct ata_device *, const char *, ...) __printflike(2, 3); -void ata_set_name(struct ata_device *, char *, int); -void ata_free_name(struct ata_device *); -int ata_get_lun(u_int32_t *); -int ata_test_lun(u_int32_t *, int); -void ata_free_lun(u_int32_t *, int); -char *ata_mode2str(int); +int ata_probe(device_t dev); +int ata_attach(device_t dev); +int ata_detach(device_t dev); +int ata_suspend(device_t dev); +int ata_resume(device_t dev); +int ata_printf(struct ata_channel *ch, int device, const char *fmt, ...) __printflike(3, 4); +int ata_prtdev(struct ata_device *atadev, const char *fmt, ...) __printflike(2, 3); +void ata_set_name(struct ata_device *atadev, char *name, int lun); +void ata_free_name(struct ata_device *atadev); +int ata_get_lun(u_int32_t *map); +int ata_test_lun(u_int32_t *map, int lun); +void ata_free_lun(u_int32_t *map, int lun); +char *ata_mode2str(int mode); int ata_pmode(struct ata_params *ap); int ata_wmode(struct ata_params *ap); int ata_umode(struct ata_params *ap); @@ -380,13 +380,13 @@ char *ata_cmd2str(struct ata_request *request); void ata_generic_hw(struct ata_channel *ch); /* subdrivers */ -void ad_attach(struct ata_device *); -void acd_attach(struct ata_device *); -void afd_attach(struct ata_device *); -void ast_attach(struct ata_device *); -void atapi_cam_attach_bus(struct ata_channel *); -void atapi_cam_detach_bus(struct ata_channel *); -void atapi_cam_reinit_bus(struct ata_channel *); +void ad_attach(struct ata_device *atadev); +void acd_attach(struct ata_device *atadev); +void afd_attach(struct ata_device *atadev); +void ast_attach(struct ata_device *atadev); +void atapi_cam_attach_bus(struct ata_channel *ch); +void atapi_cam_detach_bus(struct ata_channel *ch); +void atapi_cam_reinit_bus(struct ata_channel *ch); /* macros for locking a channel */ #define ATA_LOCK_CH(ch, value) \ diff --git a/sys/dev/ata/ata-card.c b/sys/dev/ata/ata-card.c index eea2f8b7ede0..e6e495f5e804 100644 --- a/sys/dev/ata/ata-card.c +++ b/sys/dev/ata/ata-card.c @@ -74,7 +74,7 @@ ata_pccard_match(device_t dev) /* match other devices here, primarily cdrom/dvd rom */ if ((pp = pccard_product_lookup(dev, ata_pccard_products, - sizeof(ata_pccard_products[0]), NULL)) != NULL) { + sizeof(ata_pccard_products[0]), NULL))) { if (pp->pp_name) device_set_desc(dev, pp->pp_name); return (0); diff --git a/sys/dev/ata/ata-cbus.c b/sys/dev/ata/ata-cbus.c index 1918cbbc1dd5..3fa82b2b56be 100644 --- a/sys/dev/ata/ata-cbus.c +++ b/sys/dev/ata/ata-cbus.c @@ -73,14 +73,14 @@ ata_cbus_probe(device_t dev) /* dont probe PnP devices */ if (isa_get_vendorid(dev)) - return (ENXIO); + return (ENXIO); /* allocate the ioport range */ rid = ATA_IOADDR_RID; io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, ATA_PC98_IOSIZE, RF_ACTIVE); if (!io) - return ENOMEM; + return ENOMEM; /* calculate & set the altport range */ rid = ATA_PC98_ALTADDR_RID; @@ -125,8 +125,8 @@ ata_cbus_attach(device_t dev) rid = ATA_PC98_BANKADDR_RID; ctlr->bankio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - ATA_PC98_BANK, ~0, - ATA_PC98_BANKIOSIZE, RF_ACTIVE); + ATA_PC98_BANK, ~0, + ATA_PC98_BANKIOSIZE, RF_ACTIVE); if (!ctlr->bankio) { bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io); bus_release_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, ctlr->altio); @@ -181,9 +181,8 @@ ata_cbus_alloc_resource(device_t dev, device_t child, int type, int *rid, return ctlr->altio; } } - if (type == SYS_RES_IRQ) { + if (type == SYS_RES_IRQ) return ctlr->irq; - } return 0; } diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index ebf326d94cab..c7a01a819b45 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -54,14 +54,14 @@ __FBSDID("$FreeBSD$"); #include /* prototypes */ -static void ad_detach(struct ata_device *atadev); -static void ad_start(struct ata_device *atadev); -static void ad_done(struct ata_request *request); +static void ad_detach(struct ata_device *); +static void ad_start(struct ata_device *); +static void ad_done(struct ata_request *); static disk_open_t adopen; static disk_strategy_t adstrategy; static dumper_t addump; -void ad_print(struct ad_softc *adp); -static int ad_version(u_int16_t version); +void ad_print(struct ad_softc *); +static int ad_version(u_int16_t); /* internal vars */ static MALLOC_DEFINE(M_AD, "AD driver", "ATA disk driver"); diff --git a/sys/dev/ata/ata-isa.c b/sys/dev/ata/ata-isa.c index d19c4e46a609..9dc409ed70c9 100644 --- a/sys/dev/ata/ata-isa.c +++ b/sys/dev/ata/ata-isa.c @@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ata.h" - #include #include #include diff --git a/sys/dev/ata/ata-lowlevel.c b/sys/dev/ata/ata-lowlevel.c index d40ed23d7bd6..9d0ba665bdd4 100644 --- a/sys/dev/ata/ata-lowlevel.c +++ b/sys/dev/ata/ata-lowlevel.c @@ -43,13 +43,13 @@ __FBSDID("$FreeBSD$"); #include /* prototypes */ -static int ata_transaction(struct ata_request *request); -static void ata_interrupt(void *data); -static void ata_reset(struct ata_channel *ch); -static int ata_wait(struct ata_device *atadev, u_int8_t mask); -static int ata_command(struct ata_device *atadev, u_int8_t command, u_int64_t lba, u_int16_t count, u_int16_t feature); -static void ata_pio_read(struct ata_request *request, int length); -static void ata_pio_write(struct ata_request *request, int length); +static int ata_transaction(struct ata_request *); +static void ata_interrupt(void *); +static void ata_reset(struct ata_channel *); +static int ata_wait(struct ata_device *, u_int8_t); +static int ata_command(struct ata_device *, u_int8_t, u_int64_t, u_int16_t, u_int16_t); +static void ata_pio_read(struct ata_request *, int); +static void ata_pio_write(struct ata_request *, int); /* local vars */ static int atadebug = 0; diff --git a/sys/dev/ata/ata-queue.c b/sys/dev/ata/ata-queue.c index 82d207ada488..e9b952c6be70 100644 --- a/sys/dev/ata/ata-queue.c +++ b/sys/dev/ata/ata-queue.c @@ -45,9 +45,9 @@ __FBSDID("$FreeBSD$"); #include /* prototypes */ -static void ata_completed(void *context, int pending); -static void ata_timeout(struct ata_request *request); -static char *ata_sensekey2str(u_int8_t skey); +static void ata_completed(void *, int); +static void ata_timeout(struct ata_request *); +static char *ata_sensekey2str(u_int8_t); /* local vars */ static MALLOC_DEFINE(M_ATA_REQ, "ATA request", "ATA request"); diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 1538961c6f1b..a7030e0cfab7 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -69,8 +69,8 @@ static struct cdevsw acd_cdevsw = { }; /* prototypes */ -static void acd_detach(struct ata_device *atadev); -static void acd_start(struct ata_device *atadev); +static void acd_detach(struct ata_device *); +static void acd_start(struct ata_device *); static struct acd_softc *acd_init_lun(struct ata_device *); static void acd_make_dev(struct acd_softc *); @@ -104,8 +104,8 @@ static int acd_set_speed(struct acd_softc *, int, int); static void acd_get_cap(struct acd_softc *); static int acd_read_format_caps(struct acd_softc *, struct cdr_format_capacities *); static int acd_format(struct acd_softc *, struct cdr_format_params *); -static int acd_test_ready(struct ata_device *atadev); -static int acd_request_sense(struct ata_device *atadev, struct atapi_sense *sense); +static int acd_test_ready(struct ata_device *); +static int acd_request_sense(struct ata_device *, struct atapi_sense *); /* internal vars */ static u_int32_t acd_lun_map = 0; @@ -710,8 +710,9 @@ acd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) te->data, len); if (te->address_format == CD_MSF_FORMAT) free(toc, M_ACD); - break; } + break; + case CDIOREADTOCENTRY: { struct ioc_read_toc_single_entry *te = @@ -802,8 +803,8 @@ acd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) } } error = copyout(&cdp->subchan, args->data, args->data_len); - break; } + break; case CDIOCPLAYMSF: { @@ -813,16 +814,16 @@ acd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) acd_play(cdp, msf2lba(args->start_m, args->start_s, args->start_f), msf2lba(args->end_m, args->end_s, args->end_f)); - break; } + break; case CDIOCPLAYBLOCKS: { struct ioc_play_blocks *args = (struct ioc_play_blocks *)addr; error = acd_play(cdp, args->blk, args->blk + args->len); - break; } + break; case CDIOCPLAYTRACKS: { @@ -846,8 +847,8 @@ acd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) } error = acd_play(cdp, ntohl(cdp->toc.tab[t1].addr.lba), ntohl(cdp->toc.tab[t2].addr.lba)); - break; } + break; case CDIOCGETVOL: { @@ -865,8 +866,8 @@ acd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) arg->vol[1] = cdp->au.port[1].volume; arg->vol[2] = cdp->au.port[2].volume; arg->vol[3] = cdp->au.port[3].volume; - break; } + break; case CDIOCSETVOL: { @@ -891,16 +892,17 @@ acd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) cdp->au.port[2].volume = arg->vol[2] & cdp->aumask.port[2].volume; cdp->au.port[3].volume = arg->vol[3] & cdp->aumask.port[3].volume; error = acd_mode_select(cdp, (caddr_t)&cdp->au, sizeof(cdp->au)); - break; } + break; + case CDIOCSETPATCH: { struct ioc_patch *arg = (struct ioc_patch *)addr; error = acd_setchan(cdp, arg->patch[0], arg->patch[1], arg->patch[2], arg->patch[3]); - break; } + break; case CDIOCSETMONO: error = acd_setchan(cdp, CHANNEL_0|CHANNEL_1, CHANNEL_0|CHANNEL_1, 0,0); diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index 740c36ae2a11..4304a3a88baf 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -51,15 +51,15 @@ static disk_close_t afd_close; static disk_ioctl_t afd_ioctl; #endif static disk_strategy_t afdstrategy; -static void afd_detach(struct ata_device *atadev); -static void afd_start(struct ata_device *atadev); +static void afd_detach(struct ata_device *); +static void afd_start(struct ata_device *); static int afd_sense(struct afd_softc *); static void afd_describe(struct afd_softc *); static void afd_done(struct ata_request *); static int afd_eject(struct afd_softc *, int); static int afd_start_stop(struct afd_softc *, int); static int afd_prevent_allow(struct afd_softc *, int); -static int afd_test_ready(struct ata_device *atadev); +static int afd_test_ready(struct ata_device *); /* internal vars */ static u_int32_t afd_lun_map = 0; diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index 9125cbce0991..7fce3b78ea0c 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -63,8 +63,8 @@ static struct cdevsw ast_cdevsw = { }; /* prototypes */ -static void ast_detach(struct ata_device *atadev); -static void ast_start(struct ata_device *atadev); +static void ast_detach(struct ata_device *); +static void ast_start(struct ata_device *); static int ast_sense(struct ast_softc *); static void ast_describe(struct ast_softc *); static void ast_done(struct ata_request *); @@ -78,8 +78,8 @@ static int ast_prevent_allow(struct ast_softc *stp, int); static int ast_load_unload(struct ast_softc *, u_int8_t); static int ast_rewind(struct ast_softc *); static int ast_erase(struct ast_softc *); -static int ast_test_ready(struct ata_device *atadev); -static int ast_wait_dsc(struct ata_device *atadev, int timeout); +static int ast_test_ready(struct ata_device *); +static int ast_wait_dsc(struct ata_device *, int); /* internal vars */ static u_int32_t ast_lun_map = 0; @@ -343,8 +343,9 @@ ast_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) g->mt_blksiz2 = 0; g->mt_blksiz3 = 0; g->mt_comp0 = 0; g->mt_comp1 = 0; g->mt_comp2 = 0; g->mt_comp3 = 0; - break; } + break; + case MTIOCTOP: { int i; @@ -401,8 +402,9 @@ ast_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) default: error = EINVAL; } - break; } + break; + case MTIOCRDSPOS: { struct ast_readposition position; @@ -410,8 +412,9 @@ ast_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) if ((error = ast_read_position(stp, 0, &position))) break; *(u_int32_t *)addr = position.tape; - break; } + break; + case MTIOCRDHPOS: { struct ast_readposition position; @@ -419,14 +422,17 @@ ast_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) if ((error = ast_read_position(stp, 1, &position))) break; *(u_int32_t *)addr = position.tape; - break; } + break; + case MTIOCSLOCATE: error = ast_locate(stp, 0, *(u_int32_t *)addr); break; + case MTIOCHLOCATE: error = ast_locate(stp, 1, *(u_int32_t *)addr); break; + default: error = ENOTTY; } -- cgit v1.2.3