Commit b92b31a3 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] paride cleanup and fixes

somewhat related to the above - drivers/block/paride/* switched to
module_init()/module_exit(), pd.c taught to use LBA if disks support
it (needed for paride disks >8Gb; change is fairly trivial and I've
got 40Gb one ;-)
parent 9d16ed71
...@@ -5,14 +5,9 @@ ...@@ -5,14 +5,9 @@
# Rewritten to use lists instead of if-statements. # Rewritten to use lists instead of if-statements.
# #
export-objs := paride.o bpck6.o export-objs := paride.o
obj-$(CONFIG_PARIDE) += paride.o obj-$(CONFIG_PARIDE) += paride.o
obj-$(CONFIG_PARIDE_PD) += pd.o
obj-$(CONFIG_PARIDE_PCD) += pcd.o
obj-$(CONFIG_PARIDE_PF) += pf.o
obj-$(CONFIG_PARIDE_PT) += pt.o
obj-$(CONFIG_PARIDE_PG) += pg.o
obj-$(CONFIG_PARIDE_ATEN) += aten.o obj-$(CONFIG_PARIDE_ATEN) += aten.o
obj-$(CONFIG_PARIDE_BPCK) += bpck.o obj-$(CONFIG_PARIDE_BPCK) += bpck.o
obj-$(CONFIG_PARIDE_COMM) += comm.o obj-$(CONFIG_PARIDE_COMM) += comm.o
...@@ -20,13 +15,18 @@ obj-$(CONFIG_PARIDE_DSTR) += dstr.o ...@@ -20,13 +15,18 @@ obj-$(CONFIG_PARIDE_DSTR) += dstr.o
obj-$(CONFIG_PARIDE_KBIC) += kbic.o obj-$(CONFIG_PARIDE_KBIC) += kbic.o
obj-$(CONFIG_PARIDE_EPAT) += epat.o obj-$(CONFIG_PARIDE_EPAT) += epat.o
obj-$(CONFIG_PARIDE_EPIA) += epia.o obj-$(CONFIG_PARIDE_EPIA) += epia.o
obj-$(CONFIG_PARIDE_FIT2) += fit2.o
obj-$(CONFIG_PARIDE_FIT3) += fit3.o
obj-$(CONFIG_PARIDE_FRPW) += frpw.o obj-$(CONFIG_PARIDE_FRPW) += frpw.o
obj-$(CONFIG_PARIDE_FRIQ) += friq.o obj-$(CONFIG_PARIDE_FRIQ) += friq.o
obj-$(CONFIG_PARIDE_FIT2) += fit2.o
obj-$(CONFIG_PARIDE_FIT3) += fit3.o
obj-$(CONFIG_PARIDE_ON20) += on20.o obj-$(CONFIG_PARIDE_ON20) += on20.o
obj-$(CONFIG_PARIDE_ON26) += on26.o obj-$(CONFIG_PARIDE_ON26) += on26.o
obj-$(CONFIG_PARIDE_KTTI) += ktti.o obj-$(CONFIG_PARIDE_KTTI) += ktti.o
obj-$(CONFIG_PARIDE_BPCK6) += bpck6.o obj-$(CONFIG_PARIDE_BPCK6) += bpck6.o
obj-$(CONFIG_PARIDE_PD) += pd.o
obj-$(CONFIG_PARIDE_PCD) += pcd.o
obj-$(CONFIG_PARIDE_PF) += pf.o
obj-$(CONFIG_PARIDE_PT) += pt.o
obj-$(CONFIG_PARIDE_PG) += pg.o
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#define ATEN_VERSION "1.01" #define ATEN_VERSION "1.01"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/wait.h> #include <linux/wait.h>
...@@ -140,35 +141,33 @@ static void aten_release_proto( PIA *pi ) ...@@ -140,35 +141,33 @@ static void aten_release_proto( PIA *pi )
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol aten = {"aten",0,2,2,1,1, static struct pi_protocol aten = {
aten_write_regr, .name = "aten",
aten_read_regr, .max_mode = 2,
aten_write_block, .epp_first = 2,
aten_read_block, .default_delay = 1,
aten_connect, .max_units = 1,
aten_disconnect, .write_regr = aten_write_regr,
0, .read_regr = aten_read_regr,
0, .write_block = aten_write_block,
0, .read_block = aten_read_block,
aten_log_adapter, .connect = aten_connect,
aten_init_proto, .disconnect = aten_disconnect,
aten_release_proto .log_adapter = aten_log_adapter,
}; .init_proto = aten_init_proto,
.release_proto = aten_release_proto,
};
#ifdef MODULE
static int __init aten_init(void)
int init_module(void) {
return pi_register(&aten)-1;
{ return pi_register( &aten ) - 1;
} }
void cleanup_module(void) static void __exit aten_exit(void)
{
{ pi_unregister( &aten ); pi_unregister( &aten );
} }
#endif
/* end of aten.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(aten_init)
module_exit(aten_exit)
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#define BPCK_VERSION "1.02" #define BPCK_VERSION "1.02"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -452,34 +453,36 @@ static void bpck_release_proto( PIA *pi) ...@@ -452,34 +453,36 @@ static void bpck_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol bpck = { "bpck",0,5,2,4,256, static struct pi_protocol bpck = {
bpck_write_regr, .name = "bpck",
bpck_read_regr, .max_mode = 5,
bpck_write_block, .epp_first = 2,
bpck_read_block, .default_delay = 4,
bpck_connect, .max_units = 255,
bpck_disconnect, .write_regr = bpck_write_regr,
bpck_test_port, .read_regr = bpck_read_regr,
bpck_probe_unit, .write_block = bpck_write_block,
bpck_test_proto, .read_block = bpck_read_block,
bpck_log_adapter, .connect = bpck_connect,
bpck_init_proto, .disconnect = bpck_disconnect,
bpck_release_proto .test_port = bpck_test_port,
}; .probe_unit = bpck_probe_unit,
.test_proto = bpck_test_proto,
#ifdef MODULE .log_adapter = bpck_log_adapter,
.init_proto = bpck_init_proto,
int init_module(void) .release_proto = bpck_release_proto,
};
{ return pi_register(&bpck) - 1;
static int __init bpck_init(void)
{
return pi_register(&bpck)-1;
} }
void cleanup_module(void) static void __exit bpck_exit(void)
{
{ pi_unregister(&bpck); pi_unregister(&bpck);
} }
#endif
/* end of bpck.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(bpck_init)
module_exit(bpck_exit)
...@@ -26,6 +26,7 @@ int verbose=0; /* set this to 1 to see debugging messages and whatnot */ ...@@ -26,6 +26,7 @@ int verbose=0; /* set this to 1 to see debugging messages and whatnot */
#define BACKPACK_VERSION "2.0.2" #define BACKPACK_VERSION "2.0.2"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -252,65 +253,41 @@ static void bpck6_release_proto(PIA *pi) ...@@ -252,65 +253,41 @@ static void bpck6_release_proto(PIA *pi)
kfree((void *)(pi->private)); kfree((void *)(pi->private));
} }
struct pi_protocol bpck6 = { "bpck6", /* name for proto*/ static struct pi_protocol bpck6 = {
0, /* index into proto table */ .name = "bpck6",
5, /* max mode =5 */ .max_mode = 5,
2, /* 2-5 use epp (need 8 ports) */ .epp_first = 2, /* 2-5 use epp (need 8 ports) */
0, /* no delay (not used anyway) */ .max_units = 255,
255, /* we can have units up to 255 */ .write_regr = bpck6_write_regr,
bpck6_write_regr, .read_regr = bpck6_read_regr,
bpck6_read_regr, .write_block = bpck6_write_block,
bpck6_write_block, .read_block = bpck6_read_block,
bpck6_read_block, .connect = bpck6_connect,
bpck6_connect, .disconnect = bpck6_disconnect,
bpck6_disconnect, .test_port = bpck6_test_port,
bpck6_test_port, .probe_unit = bpck6_probe_unit,
bpck6_probe_unit, .log_adapter = bpck6_log_adapter,
0, .init_proto = bpck6_init_proto,
bpck6_log_adapter, .release_proto = bpck6_release_proto,
bpck6_init_proto, };
bpck6_release_proto
}; static int __init bpck6_init(void)
EXPORT_SYMBOL(bpck6_write_regr);
EXPORT_SYMBOL(bpck6_read_regr);
EXPORT_SYMBOL(bpck6_write_block);
EXPORT_SYMBOL(bpck6_read_block);
EXPORT_SYMBOL(bpck6_connect);
EXPORT_SYMBOL(bpck6_disconnect);
EXPORT_SYMBOL(bpck6_test_port);
EXPORT_SYMBOL(bpck6_probe_unit);
EXPORT_SYMBOL(bpck6_log_adapter);
EXPORT_SYMBOL(bpck6_init_proto);
EXPORT_SYMBOL(bpck6_release_proto);
/*---------------------------MODULE STUFF-----------------------*/
#ifdef MODULE
/*module information*/
static int init_module(void)
{ {
printk(KERN_INFO "bpck6: BACKPACK Protocol Driver V"BACKPACK_VERSION"\n"); printk(KERN_INFO "bpck6: BACKPACK Protocol Driver V"BACKPACK_VERSION"\n");
printk(KERN_INFO "bpck6: Copyright 2001 by Micro Solutions, Inc., DeKalb IL. USA\n"); printk(KERN_INFO "bpck6: Copyright 2001 by Micro Solutions, Inc., DeKalb IL. USA\n");
if(verbose) if(verbose)
{
printk(KERN_DEBUG "bpck6: verbose debug enabled.\n"); printk(KERN_DEBUG "bpck6: verbose debug enabled.\n");
}
return pi_register(&bpck6) - 1; return pi_register(&bpck6) - 1;
} }
void cleanup_module(void) static void __exit bpck6_exit(void)
{ {
pi_unregister(&bpck6); pi_unregister(&bpck6);
} }
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Micro Solutions Inc."); MODULE_AUTHOR("Micro Solutions Inc.");
MODULE_DESCRIPTION("BACKPACK Protocol module, compatible with PARIDE"); MODULE_DESCRIPTION("BACKPACK Protocol module, compatible with PARIDE");
MODULE_PARM(verbose,"i"); MODULE_PARM(verbose,"i");
module_init(bpck6_init)
#endif module_exit(bpck6_exit)
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#define COMM_VERSION "1.01" #define COMM_VERSION "1.01"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -196,35 +197,33 @@ static void comm_release_proto(PIA *pi) ...@@ -196,35 +197,33 @@ static void comm_release_proto(PIA *pi)
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol comm = {"comm",0,5,2,1,1, static struct pi_protocol comm = {
comm_write_regr, .name = "comm",
comm_read_regr, .max_mode = 5,
comm_write_block, .epp_first = 2,
comm_read_block, .default_delay = 1,
comm_connect, .max_units = 1,
comm_disconnect, .write_regr = comm_write_regr,
0, .read_regr = comm_read_regr,
0, .write_block = comm_write_block,
0, .read_block = comm_read_block,
comm_log_adapter, .connect = comm_connect,
comm_init_proto, .disconnect = comm_disconnect,
comm_release_proto .log_adapter = comm_log_adapter,
}; .init_proto = comm_init_proto,
.release_proto = comm_release_proto,
};
#ifdef MODULE
static int __init comm_init(void)
int init_module(void) {
return pi_register(&comm)-1;
{ return pi_register( &comm ) - 1;
} }
void cleanup_module(void) static void __exit comm_exit(void)
{
{ pi_unregister( &comm ); pi_unregister(&comm);
} }
#endif
/* end of comm.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(comm_init)
module_exit(comm_exit)
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#define DSTR_VERSION "1.01" #define DSTR_VERSION "1.01"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -211,35 +212,33 @@ static void dstr_release_proto( PIA *pi) ...@@ -211,35 +212,33 @@ static void dstr_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol dstr = {"dstr",0,5,2,1,1, static struct pi_protocol dstr = {
dstr_write_regr, .name = "dstr",
dstr_read_regr, .max_mode = 5,
dstr_write_block, .epp_first = 2,
dstr_read_block, .default_delay = 1,
dstr_connect, .max_units = 1,
dstr_disconnect, .write_regr = dstr_write_regr,
0, .read_regr = dstr_read_regr,
0, .write_block = dstr_write_block,
0, .read_block = dstr_read_block,
dstr_log_adapter, .connect = dstr_connect,
dstr_init_proto, .disconnect = dstr_disconnect,
dstr_release_proto .log_adapter = dstr_log_adapter,
}; .init_proto = dstr_init_proto,
.release_proto = dstr_release_proto,
};
#ifdef MODULE
static int __init dstr_init(void)
int init_module(void) {
return pi_register(&dstr)-1;
{ return pi_register( &dstr ) - 1;
} }
void cleanup_module(void) static void __exit dstr_exit(void)
{
{ pi_unregister( &dstr ); pi_unregister(&dstr);
} }
#endif
/* end of dstr.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(dstr_init)
module_exit(dstr_exit)
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define EPAT_VERSION "1.02" #define EPAT_VERSION "1.02"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -311,35 +312,34 @@ static void epat_release_proto( PIA *pi) ...@@ -311,35 +312,34 @@ static void epat_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol epat = {"epat",0,6,3,1,1, static struct pi_protocol epat = {
epat_write_regr, .name = "epat",
epat_read_regr, .max_mode = 6,
epat_write_block, .epp_first = 3,
epat_read_block, .default_delay = 1,
epat_connect, .max_units = 1,
epat_disconnect, .write_regr = epat_write_regr,
0, .read_regr = epat_read_regr,
0, .write_block = epat_write_block,
epat_test_proto, .read_block = epat_read_block,
epat_log_adapter, .connect = epat_connect,
epat_init_proto, .disconnect = epat_disconnect,
epat_release_proto .test_proto = epat_test_proto,
}; .log_adapter = epat_log_adapter,
.init_proto = epat_init_proto,
.release_proto = epat_release_proto,
#ifdef MODULE };
int init_module(void) static int __init epat_init(void)
{
{ return pi_register( &epat) - 1; return pi_register(&epat)-1;
} }
void cleanup_module(void) static void __exit epat_exit(void)
{
{ pi_unregister( &epat); pi_unregister(&epat);
} }
#endif
/* end of epat.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(epat_init)
module_exit(epat_exit)
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define EPIA_VERSION "1.02" #define EPIA_VERSION "1.02"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -293,36 +294,34 @@ static void epia_release_proto( PIA *pi) ...@@ -293,36 +294,34 @@ static void epia_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol epia = {"epia",0,6,3,1,1, static struct pi_protocol epia = {
epia_write_regr, .name = "epia",
epia_read_regr, .max_mode = 6,
epia_write_block, .epp_first = 3,
epia_read_block, .default_delay = 1,
epia_connect, .max_units = 1,
epia_disconnect, .write_regr = epia_write_regr,
0, .read_regr = epia_read_regr,
0, .write_block = epia_write_block,
epia_test_proto, .read_block = epia_read_block,
epia_log_adapter, .connect = epia_connect,
epia_init_proto, .disconnect = epia_disconnect,
epia_release_proto .test_proto = epia_test_proto,
}; .log_adapter = epia_log_adapter,
.init_proto = epia_init_proto,
.release_proto = epia_release_proto,
#ifdef MODULE };
int init_module(void) static int __init epia_init(void)
{
{ return pi_register( &epia ) - 1; return pi_register(&epia)-1;
} }
void cleanup_module(void) static void __exit epia_exit(void)
{
{ pi_unregister( &epia ); pi_unregister(&epia);
} }
#endif
/* end of epia.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(epia_init)
module_exit(epia_exit)
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#define FIT2_VERSION "1.0" #define FIT2_VERSION "1.0"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -129,35 +130,33 @@ static void fit2_release_proto( PIA *pi) ...@@ -129,35 +130,33 @@ static void fit2_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol fit2 = {"fit2",0,1,2,1,1, static struct pi_protocol fit2 = {
fit2_write_regr, .name = "fit2",
fit2_read_regr, .max_mode = 1,
fit2_write_block, .epp_first = 2,
fit2_read_block, .default_delay = 1,
fit2_connect, .max_units = 1,
fit2_disconnect, .write_regr = fit2_write_regr,
0, .read_regr = fit2_read_regr,
0, .write_block = fit2_write_block,
0, .read_block = fit2_read_block,
fit2_log_adapter, .connect = fit2_connect,
fit2_init_proto, .disconnect = fit2_disconnect,
fit2_release_proto .log_adapter = fit2_log_adapter,
}; .init_proto = fit2_init_proto,
.release_proto = fit2_release_proto,
};
#ifdef MODULE
static int __init fit2_init(void)
int init_module(void) {
return pi_register(&fit2)-1;
{ return pi_register( &fit2 ) - 1;
} }
void cleanup_module(void) static void __exit fit2_exit(void)
{
{ pi_unregister( &fit2 ); pi_unregister(&fit2);
} }
#endif
/* end of fit2.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(fit2_init)
module_exit(fit2_exit)
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define FIT3_VERSION "1.0" #define FIT3_VERSION "1.0"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -189,35 +190,33 @@ static void fit3_release_proto(PIA *pi) ...@@ -189,35 +190,33 @@ static void fit3_release_proto(PIA *pi)
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol fit3 = {"fit3",0,3,2,1,1, static struct pi_protocol fit3 = {
fit3_write_regr, .name = "fit3",
fit3_read_regr, .max_mode = 3,
fit3_write_block, .epp_first = 2,
fit3_read_block, .default_delay = 1,
fit3_connect, .max_units = 1,
fit3_disconnect, .write_regr = fit3_write_regr,
0, .read_regr = fit3_read_regr,
0, .write_block = fit3_write_block,
0, .read_block = fit3_read_block,
fit3_log_adapter, .connect = fit3_connect,
fit3_init_proto, .disconnect = fit3_disconnect,
fit3_release_proto .log_adapter = fit3_log_adapter,
}; .init_proto = fit3_init_proto,
.release_proto = fit3_release_proto,
};
#ifdef MODULE
static int __init fit3_init(void)
int init_module(void) {
return pi_register(&fit3)-1;
{ return pi_register( &fit3 ) - 1;
} }
void cleanup_module(void) static void __exit fit3_exit(void)
{
{ pi_unregister( &fit3 ); pi_unregister(&fit3);
} }
#endif
/* end of fit3.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(fit3_init)
module_exit(fit3_exit)
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#define FRIQ_VERSION "1.01" #define FRIQ_VERSION "1.01"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -250,35 +251,34 @@ static void friq_release_proto( PIA *pi) ...@@ -250,35 +251,34 @@ static void friq_release_proto( PIA *pi)
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
} }
struct pi_protocol friq = {"friq",0,5,2,1,1, static struct pi_protocol friq = {
friq_write_regr, .name = "friq",
friq_read_regr, .max_mode = 5,
friq_write_block, .epp_first = 2,
friq_read_block, .default_delay = 1,
friq_connect, .max_units = 1,
friq_disconnect, .write_regr = friq_write_regr,
0, .read_regr = friq_read_regr,
0, .write_block = friq_write_block,
friq_test_proto, .read_block = friq_read_block,
friq_log_adapter, .connect = friq_connect,
friq_init_proto, .disconnect = friq_disconnect,
friq_release_proto .test_proto = friq_test_proto,
}; .log_adapter = friq_log_adapter,
.init_proto = friq_init_proto,
.release_proto = friq_release_proto,
#ifdef MODULE };
int init_module(void) static int __init friq_init(void)
{
{ return pi_register( &friq ) - 1; return pi_register(&friq)-1;
} }
void cleanup_module(void) static void __exit friq_exit(void)
{
{ pi_unregister( &friq ); pi_unregister(&friq);
} }
#endif
/* end of friq.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(friq_init)
module_exit(friq_exit)
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define FRPW_VERSION "1.03" #define FRPW_VERSION "1.03"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -291,35 +292,34 @@ static void frpw_release_proto( PIA *pi) ...@@ -291,35 +292,34 @@ static void frpw_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol frpw = {"frpw",0,6,2,2,1, static struct pi_protocol frpw = {
frpw_write_regr, .name = "frpw",
frpw_read_regr, .max_mode = 6,
frpw_write_block, .epp_first = 2,
frpw_read_block, .default_delay = 2,
frpw_connect, .max_units = 1,
frpw_disconnect, .write_regr = frpw_write_regr,
0, .read_regr = frpw_read_regr,
0, .write_block = frpw_write_block,
frpw_test_proto, .read_block = frpw_read_block,
frpw_log_adapter, .connect = frpw_connect,
frpw_init_proto, .disconnect = frpw_disconnect,
frpw_release_proto .test_proto = frpw_test_proto,
}; .log_adapter = frpw_log_adapter,
.init_proto = frpw_init_proto,
.release_proto = frpw_release_proto,
#ifdef MODULE };
int init_module(void) static int __init frpw_init(void)
{
{ return pi_register( &frpw ) - 1; return pi_register(&frpw)-1;
} }
void cleanup_module(void) static void __exit frpw_exit(void)
{
{ pi_unregister( &frpw ); pi_unregister(&frpw);
} }
#endif
/* end of frpw.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(frpw_init)
module_exit(frpw_exit)
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define KBIC_VERSION "1.01" #define KBIC_VERSION "1.01"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -258,56 +259,51 @@ static void kbic_release_proto( PIA *pi) ...@@ -258,56 +259,51 @@ static void kbic_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol k951 = {"k951",0,6,3,1,1, static struct pi_protocol k951 = {
kbic_write_regr, .name = "k951",
kbic_read_regr, .max_mode = 6,
kbic_write_block, .epp_first = 3,
kbic_read_block, .default_delay = 1,
k951_connect, .max_units = 1,
k951_disconnect, .write_regr = kbic_write_regr,
0, .read_regr = kbic_read_regr,
0, .write_block = kbic_write_block,
0, .read_block = kbic_read_block,
k951_log_adapter, .connect = k951_connect,
kbic_init_proto, .disconnect = k951_disconnect,
kbic_release_proto .log_adapter = k951_log_adapter,
}; .init_proto = kbic_init_proto,
.release_proto = kbic_release_proto
};
struct pi_protocol k971 = {"k971",0,6,3,1,1,
kbic_write_regr, static struct pi_protocol k971 = {
kbic_read_regr, .name = "k971",
kbic_write_block, .max_mode = 6,
kbic_read_block, .epp_first = 3,
k971_connect, .default_delay = 1,
k971_disconnect, .max_units = 1,
0, .write_regr = kbic_write_regr,
0, .read_regr = kbic_read_regr,
0, .write_block = kbic_write_block,
k971_log_adapter, .read_block = kbic_read_block,
kbic_init_proto, .connect = k971_connect,
kbic_release_proto .disconnect = k971_disconnect,
}; .log_adapter = k971_log_adapter,
.init_proto = kbic_init_proto,
#ifdef MODULE .release_proto = kbic_release_proto
};
int init_module(void)
static int __init kbic_init(void)
{ int s5,s7; {
return (pi_register(&k951)||pi_register(&k971))-1;
s5 = pi_register(&k951);
s7 = pi_register(&k971);
return (s5 || s7) - 1;
} }
void cleanup_module(void) static void __exit kbic_exit(void)
{
{ pi_unregister( &k951 ); pi_unregister(&k951);
pi_unregister( &k971 ); pi_unregister(&k971);
} }
#endif
/* end of kbic.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(kbic_init)
module_exit(kbic_exit)
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#define KTTI_VERSION "1.0" #define KTTI_VERSION "1.0"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -106,35 +107,33 @@ static void ktti_release_proto( PIA *pi) ...@@ -106,35 +107,33 @@ static void ktti_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol ktti = {"ktti",0,1,2,1,1, static struct pi_protocol ktti = {
ktti_write_regr, .name = "ktti",
ktti_read_regr, .max_mode = 1,
ktti_write_block, .epp_first = 2,
ktti_read_block, .default_delay = 1,
ktti_connect, .max_units = 1,
ktti_disconnect, .write_regr = ktti_write_regr,
0, .read_regr = ktti_read_regr,
0, .write_block = ktti_write_block,
0, .read_block = ktti_read_block,
ktti_log_adapter, .connect = ktti_connect,
ktti_init_proto, .disconnect = ktti_disconnect,
ktti_release_proto .log_adapter = ktti_log_adapter,
}; .init_proto = ktti_init_proto,
.release_proto = ktti_release_proto,
};
#ifdef MODULE
static int __init ktti_init(void)
int init_module(void) {
return pi_register(&ktti)-1;
{ return pi_register( &ktti ) - 1;
} }
void cleanup_module(void) static void __exit ktti_exit(void)
{
{ pi_unregister( &ktti ); pi_unregister(&ktti);
} }
#endif
/* end of ktti.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(ktti_init)
module_exit(ktti_exit)
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#define ON20_VERSION "1.01" #define ON20_VERSION "1.01"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -131,35 +132,33 @@ static void on20_release_proto( PIA *pi) ...@@ -131,35 +132,33 @@ static void on20_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol on20 = {"on20",0,2,2,1,1, static struct pi_protocol on20 = {
on20_write_regr, .name = "on20",
on20_read_regr, .max_mode = 2,
on20_write_block, .epp_first = 2,
on20_read_block, .default_delay = 1,
on20_connect, .max_units = 1,
on20_disconnect, .write_regr = on20_write_regr,
0, .read_regr = on20_read_regr,
0, .write_block = on20_write_block,
0, .read_block = on20_read_block,
on20_log_adapter, .connect = on20_connect,
on20_init_proto, .disconnect = on20_disconnect,
on20_release_proto .log_adapter = on20_log_adapter,
}; .init_proto = on20_init_proto,
.release_proto = on20_release_proto,
};
#ifdef MODULE
static int __init on20_init(void)
int init_module(void) {
return pi_register(&on20)-1;
{ return pi_register( &on20 ) - 1;
} }
void cleanup_module(void) static void __exit on20_exit(void)
{
{ pi_unregister( &on20 ); pi_unregister(&on20);
} }
#endif
/* end of on20.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(on20_init)
module_exit(on20_exit)
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define ON26_VERSION "1.04" #define ON26_VERSION "1.04"
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -296,36 +297,34 @@ static void on26_release_proto( PIA *pi) ...@@ -296,36 +297,34 @@ static void on26_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT; { MOD_DEC_USE_COUNT;
} }
struct pi_protocol on26 = {"on26",0,5,2,1,1, static struct pi_protocol on26 = {
on26_write_regr, .name = "on26",
on26_read_regr, .max_mode = 5,
on26_write_block, .epp_first = 2,
on26_read_block, .default_delay = 1,
on26_connect, .max_units = 1,
on26_disconnect, .write_regr = on26_write_regr,
on26_test_port, .read_regr = on26_read_regr,
0, .write_block = on26_write_block,
0, .read_block = on26_read_block,
on26_log_adapter, .connect = on26_connect,
on26_init_proto, .disconnect = on26_disconnect,
on26_release_proto .test_port = on26_test_port,
}; .log_adapter = on26_log_adapter,
.init_proto = on26_init_proto,
.release_proto = on26_release_proto,
#ifdef MODULE };
int init_module(void) static int __init on26_init(void)
{
{ return pi_register( &on26 ) - 1; return pi_register(&on26)-1;
} }
void cleanup_module(void) static void __exit on26_exit(void)
{
{ pi_unregister( &on26 ); pi_unregister(&on26);
} }
#endif
/* end of on26.c */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(on26_init)
module_exit(on26_exit)
...@@ -431,136 +431,3 @@ int pi_init(PIA *pi, int autoprobe, int port, int mode, ...@@ -431,136 +431,3 @@ int pi_init(PIA *pi, int autoprobe, int port, int mode,
} }
EXPORT_SYMBOL(pi_init); EXPORT_SYMBOL(pi_init);
#ifdef MODULE
int init_module(void)
{
int k;
const char *indicate_pp = "";
#ifdef CONFIG_PARPORT
indicate_pp = " (parport)";
#endif
for (k=0;k<MAX_PROTOS;k++) protocols[k] = 0;
printk("paride: version %s installed%s\n",PI_VERSION,indicate_pp);
return 0;
}
void cleanup_module(void)
{
}
#else
void paride_init( void )
{
#ifdef CONFIG_PARIDE_ATEN
{ extern struct pi_protocol aten;
pi_register(&aten);
};
#endif
#ifdef CONFIG_PARIDE_BPCK
{ extern struct pi_protocol bpck;
pi_register(&bpck);
};
#endif
#ifdef CONFIG_PARIDE_COMM
{ extern struct pi_protocol comm;
pi_register(&comm);
};
#endif
#ifdef CONFIG_PARIDE_DSTR
{ extern struct pi_protocol dstr;
pi_register(&dstr);
};
#endif
#ifdef CONFIG_PARIDE_EPAT
{ extern struct pi_protocol epat;
pi_register(&epat);
};
#endif
#ifdef CONFIG_PARIDE_EPIA
{ extern struct pi_protocol epia;
pi_register(&epia);
};
#endif
#ifdef CONFIG_PARIDE_FRPW
{ extern struct pi_protocol frpw;
pi_register(&frpw);
};
#endif
#ifdef CONFIG_PARIDE_FRIQ
{ extern struct pi_protocol friq;
pi_register(&friq);
};
#endif
#ifdef CONFIG_PARIDE_FIT2
{ extern struct pi_protocol fit2;
pi_register(&fit2);
};
#endif
#ifdef CONFIG_PARIDE_FIT3
{ extern struct pi_protocol fit3;
pi_register(&fit3);
};
#endif
#ifdef CONFIG_PARIDE_KBIC
{ extern struct pi_protocol k951;
extern struct pi_protocol k971;
pi_register(&k951);
pi_register(&k971);
};
#endif
#ifdef CONFIG_PARIDE_KTTI
{ extern struct pi_protocol ktti;
pi_register(&ktti);
};
#endif
#ifdef CONFIG_PARIDE_ON20
{ extern struct pi_protocol on20;
pi_register(&on20);
};
#endif
#ifdef CONFIG_PARIDE_ON26
{ extern struct pi_protocol on26;
pi_register(&on26);
};
#endif
#ifdef CONFIG_PARIDE_PD
{ extern int pd_init(void);
pd_init();
};
#endif
#ifdef CONFIG_PARIDE_PCD
{ extern int pcd_init(void);
pcd_init();
};
#endif
#ifdef CONFIG_PARIDE_PF
{ extern int pf_init(void);
pf_init();
};
#endif
#ifdef CONFIG_PARIDE_PT
{ extern int pt_init(void);
pt_init();
};
#endif
#ifdef CONFIG_PARIDE_PG
{ extern int pg_init(void);
pg_init();
};
#endif
}
#endif
/* end of paride.c */
MODULE_LICENSE("GPL");
...@@ -137,6 +137,7 @@ static int pcd_drive_count; ...@@ -137,6 +137,7 @@ static int pcd_drive_count;
/* end of parameters */ /* end of parameters */
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -200,9 +201,6 @@ MODULE_PARM(drive3,"1-6i"); ...@@ -200,9 +201,6 @@ MODULE_PARM(drive3,"1-6i");
#define IDE_READY 0x40 #define IDE_READY 0x40
#define IDE_BUSY 0x80 #define IDE_BUSY 0x80
int pcd_init(void);
void cleanup_module( void );
static int pcd_open(struct cdrom_device_info *cdi, int purpose); static int pcd_open(struct cdrom_device_info *cdi, int purpose);
static void pcd_release(struct cdrom_device_info *cdi); static void pcd_release(struct cdrom_device_info *cdi);
static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr); static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr);
...@@ -327,84 +325,18 @@ static void pcd_init_units( void ) ...@@ -327,84 +325,18 @@ static void pcd_init_units( void )
} }
} }
int pcd_init (void) /* preliminary initialisation */
{
int unit;
if (disable) return -1;
pcd_init_units();
if (pcd_detect()) return -1;
/* get the atapi capabilities page */
pcd_probe_capabilities();
if (register_blkdev(MAJOR_NR,name,&pcd_bdops)) {
printk("pcd: unable to get major number %d\n",MAJOR_NR);
return -1;
}
for (unit=0;unit<PCD_UNITS;unit++) {
if (PCD.present) {
register_cdrom(&PCD.info);
devfs_plain_cdrom(&PCD.info, &pcd_bdops);
}
}
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_pcd_request, &pcd_lock);
return 0;
}
static int pcd_open(struct cdrom_device_info *cdi, int purpose) static int pcd_open(struct cdrom_device_info *cdi, int purpose)
{
{ int unit = DEVICE_NR(cdi->dev); int unit = DEVICE_NR(cdi->dev);
if ((unit >= PCD_UNITS) || (!PCD.present))
if ((unit >= PCD_UNITS) || (!PCD.present)) return -ENODEV; return -ENODEV;
return 0; return 0;
} }
static void pcd_release(struct cdrom_device_info *cdi) static void pcd_release(struct cdrom_device_info *cdi)
{ {
} }
#ifdef MODULE
/* Glue for modules ... */
int init_module(void)
{ int err;
#ifdef PARIDE_JUMBO
{ extern paride_init();
paride_init();
}
#endif
err = pcd_init();
return err;
}
void cleanup_module(void)
{ int unit;
for (unit=0;unit<PCD_UNITS;unit++)
if (PCD.present) {
pi_release(PI);
unregister_cdrom(&PCD.info);
}
unregister_blkdev(MAJOR_NR,name);
}
#endif
#define WR(c,r,v) pi_write_regr(PI,c,r,v) #define WR(c,r,v) pi_write_regr(PI,c,r,v)
#define RR(c,r) (pi_read_regr(PI,c,r)) #define RR(c,r) (pi_read_regr(PI,c,r))
...@@ -950,6 +882,50 @@ static int pcd_get_mcn (struct cdrom_device_info *cdi, struct cdrom_mcn *mcn) ...@@ -950,6 +882,50 @@ static int pcd_get_mcn (struct cdrom_device_info *cdi, struct cdrom_mcn *mcn)
return 0; return 0;
} }
/* end of pcd.c */
static int __init pcd_init(void)
{
int unit;
if (disable)
return -1;
pcd_init_units();
if (pcd_detect())
return -1;
/* get the atapi capabilities page */
pcd_probe_capabilities();
if (register_blkdev(MAJOR_NR,name,&pcd_bdops)) {
printk("pcd: unable to get major number %d\n",MAJOR_NR);
return -1;
}
for (unit=0;unit<PCD_UNITS;unit++) {
if (PCD.present) {
register_cdrom(&PCD.info);
devfs_plain_cdrom(&PCD.info, &pcd_bdops);
}
}
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_pcd_request, &pcd_lock);
return 0;
}
static void __exit pcd_exit(void)
{
int unit;
for (unit=0;unit<PCD_UNITS;unit++)
if (PCD.present) {
pi_release(PI);
unregister_cdrom(&PCD.info);
}
unregister_blkdev(MAJOR_NR,name);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(pcd_init)
module_exit(pcd_exit)
...@@ -153,16 +153,12 @@ static int pd_drive_count; ...@@ -153,16 +153,12 @@ static int pd_drive_count;
/* end of parameters */ /* end of parameters */
#include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/kernel.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/genhd.h>
#include <linux/hdreg.h> #include <linux/hdreg.h>
#include <linux/cdrom.h> /* for the eject ioctl */ #include <linux/cdrom.h> /* for the eject ioctl */
#include <linux/spinlock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -181,8 +177,8 @@ static STT pd_stt[7] = {{"drive0",8,drive0}, ...@@ -181,8 +177,8 @@ static STT pd_stt[7] = {{"drive0",8,drive0},
{"nice",1,&nice}}; {"nice",1,&nice}};
void pd_setup( char *str, int *ints) void pd_setup( char *str, int *ints)
{
{ generic_setup(pd_stt,7,str); generic_setup(pd_stt,7,str);
} }
#endif #endif
...@@ -199,19 +195,15 @@ MODULE_PARM(drive3,"1-8i"); ...@@ -199,19 +195,15 @@ MODULE_PARM(drive3,"1-8i");
#include "paride.h" #include "paride.h"
#define PD_BITS 4
/* set up defines for blk.h, why don't all drivers do it this way ? */
#define MAJOR_NR major #define MAJOR_NR major
#define DEVICE_NR(device) (minor(device)>>PD_BITS)
#define DEVICE_OFF(device)
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/blkpg.h> #include <linux/blkpg.h>
#include "pseudo.h" #include "pseudo.h"
#define PD_BITS 4
#define DEVICE_NR(device) (minor(device)>>PD_BITS)
#define PD_PARTNS (1<<PD_BITS) #define PD_PARTNS (1<<PD_BITS)
#define PD_DEVS PD_PARTNS*PD_UNITS #define PD_DEVS PD_PARTNS*PD_UNITS
...@@ -258,11 +250,7 @@ MODULE_PARM(drive3,"1-8i"); ...@@ -258,11 +250,7 @@ MODULE_PARM(drive3,"1-8i");
#define IDE_IDENTIFY 0xec #define IDE_IDENTIFY 0xec
#define IDE_EJECT 0xed #define IDE_EJECT 0xed
int pd_init(void);
void pd_setup(char * str, int * ints); void pd_setup(char * str, int * ints);
#ifdef MODULE
void cleanup_module( void );
#endif
static int pd_open(struct inode *inode, struct file *file); static int pd_open(struct inode *inode, struct file *file);
static void do_pd_request(request_queue_t * q); static void do_pd_request(request_queue_t * q);
static int pd_ioctl(struct inode *inode,struct file *file, static int pd_ioctl(struct inode *inode,struct file *file,
...@@ -296,6 +284,7 @@ struct pd_unit { ...@@ -296,6 +284,7 @@ struct pd_unit {
int heads; /* physical geometry */ int heads; /* physical geometry */
int sectors; int sectors;
int cylinders; int cylinders;
int can_lba;
int drive; /* master=0 slave=1 */ int drive; /* master=0 slave=1 */
int changed; /* Have we seen a disk change ? */ int changed; /* Have we seen a disk change ? */
int removable; /* removable media device ? */ int removable; /* removable media device ? */
...@@ -303,7 +292,7 @@ struct pd_unit { ...@@ -303,7 +292,7 @@ struct pd_unit {
int alt_geom; int alt_geom;
int present; int present;
char name[PD_NAMELEN]; /* pda, pdb, etc ... */ char name[PD_NAMELEN]; /* pda, pdb, etc ... */
}; };
struct pd_unit pd[PD_UNITS]; struct pd_unit pd[PD_UNITS];
...@@ -312,7 +301,6 @@ struct pd_unit pd[PD_UNITS]; ...@@ -312,7 +301,6 @@ struct pd_unit pd[PD_UNITS];
#define PD pd[unit] #define PD pd[unit]
#define PI PD.pi #define PI PD.pi
static int pd_valid = 1; /* serialise partition checks */
static char pd_scratch[512]; /* scratch block buffer */ static char pd_scratch[512]; /* scratch block buffer */
/* the variables below are used mainly in the I/O request engine, which /* the variables below are used mainly in the I/O request engine, which
...@@ -379,40 +367,6 @@ void pd_init_units( void ) ...@@ -379,40 +367,6 @@ void pd_init_units( void )
} }
} }
int pd_init (void)
{
request_queue_t * q;
if (disable) return -1;
if (devfs_register_blkdev(MAJOR_NR,name,&pd_fops)) {
printk("%s: unable to get major number %d\n",
name,major);
return -1;
}
q = BLK_DEFAULT_QUEUE(MAJOR_NR);
blk_init_queue(q, do_pd_request, &pd_lock);
blk_queue_max_sectors(q, cluster);
pd_gendisk.major = major;
pd_gendisk.major_name = name;
add_gendisk(&pd_gendisk);
printk("%s: %s version %s, major %d, cluster %d, nice %d\n",
name,name,PD_VERSION,major,cluster,nice);
pd_init_units();
pd_valid = 0;
pd_gendisk.nr_real = pd_detect();
pd_valid = 1;
#ifdef MODULE
if (!pd_gendisk.nr_real) {
cleanup_module();
return -1;
}
#endif
return 0;
}
static int pd_open (struct inode *inode, struct file *file) static int pd_open (struct inode *inode, struct file *file)
{ {
int unit = DEVICE_NR(inode->i_rdev); int unit = DEVICE_NR(inode->i_rdev);
...@@ -433,11 +387,8 @@ static int pd_ioctl(struct inode *inode,struct file *file, ...@@ -433,11 +387,8 @@ static int pd_ioctl(struct inode *inode,struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct hd_geometry *geo = (struct hd_geometry *) arg; struct hd_geometry *geo = (struct hd_geometry *) arg;
int err, unit; int err, unit = DEVICE_NR(inode->i_rdev);
if (!inode || kdev_none(inode->i_rdev))
return -EINVAL;
unit = DEVICE_NR(inode->i_rdev);
if (!PD.present) if (!PD.present)
return -ENODEV; return -ENODEV;
...@@ -475,24 +426,19 @@ static int pd_release (struct inode *inode, struct file *file) ...@@ -475,24 +426,19 @@ static int pd_release (struct inode *inode, struct file *file)
{ {
int unit = DEVICE_NR(inode->i_rdev); int unit = DEVICE_NR(inode->i_rdev);
if ((unit >= PD_UNITS) || (PD.access <= 0)) if (!--PD.access && PD.removable)
return -EINVAL;
PD.access--;
if (!PD.access && PD.removable)
pd_doorlock(unit,IDE_DOORUNLOCK); pd_doorlock(unit,IDE_DOORUNLOCK);
return 0; return 0;
} }
static int pd_check_media( kdev_t dev) static int pd_check_media( kdev_t dev)
{
{ int r, unit; int r, unit = DEVICE_NR(dev);
if ((unit >= PD_UNITS) || (!PD.present))
unit = DEVICE_NR(dev); return -ENODEV;
if ((unit >= PD_UNITS) || (!PD.present)) return -ENODEV; if (!PD.removable)
if (!PD.removable) return 0; return 0;
pd_media_check(unit); pd_media_check(unit);
r = PD.changed; r = PD.changed;
PD.changed = 0; PD.changed = 0;
...@@ -521,37 +467,6 @@ static int pd_revalidate(kdev_t dev) ...@@ -521,37 +467,6 @@ static int pd_revalidate(kdev_t dev)
return res; return res;
} }
#ifdef MODULE
/* Glue for modules ... */
void cleanup_module(void);
int init_module(void)
{
#ifdef PARIDE_JUMBO
{ extern paride_init();
paride_init();
}
#endif
return pd_init();
}
void cleanup_module(void)
{
int unit;
devfs_unregister_blkdev(MAJOR_NR, name);
del_gendisk(&pd_gendisk);
for (unit=0; unit<PD_UNITS; unit++)
if (PD.present)
pi_release(PI);
}
#endif
#define WR(c,r,v) pi_write_regr(PI,c,r,v) #define WR(c,r,v) pi_write_regr(PI,c,r,v)
#define RR(c,r) (pi_read_regr(PI,c,r)) #define RR(c,r) (pi_read_regr(PI,c,r))
...@@ -600,7 +515,6 @@ static int pd_wait_for( int unit, int w, char * msg ) /* polled wait */ ...@@ -600,7 +515,6 @@ static int pd_wait_for( int unit, int w, char * msg ) /* polled wait */
static void pd_send_command( int unit, int n, int s, int h, static void pd_send_command( int unit, int n, int s, int h,
int c0, int c1, int func ) int c0, int c1, int func )
{ {
WR(0,6,DRIVE+h); WR(0,6,DRIVE+h);
WR(0,1,0); /* the IDE task file */ WR(0,1,0); /* the IDE task file */
...@@ -614,16 +528,20 @@ static void pd_send_command( int unit, int n, int s, int h, ...@@ -614,16 +528,20 @@ static void pd_send_command( int unit, int n, int s, int h,
} }
static void pd_ide_command( int unit, int func, int block, int count ) static void pd_ide_command( int unit, int func, int block, int count )
{
int c1, c0, h, s;
/* Don't use this call if the capacity is zero. */ if (PD.can_lba) {
s = block & 255;
{ int c1, c0, h, s; c0 = (block >>= 8) & 255;
c1 = (block >>= 8) & 255;
h = ((block >>= 8) & 15) + 0x40;
} else {
s = ( block % PD.sectors) + 1; s = ( block % PD.sectors) + 1;
h = ( block / PD.sectors) % PD.heads; h = ( block /= PD.sectors) % PD.heads;
c0 = ( block / (PD.sectors*PD.heads)) % 256; c0 = ( block /= PD.heads) % 256;
c1 = ( block / (PD.sectors*PD.heads*256)); c1 = (block >>= 8);
}
pd_send_command(unit,count,s,h,c0,c1,func); pd_send_command(unit,count,s,h,c0,c1,func);
} }
...@@ -723,9 +641,13 @@ static int pd_identify( int unit ) ...@@ -723,9 +641,13 @@ static int pd_identify( int unit )
} }
pi_read_block(PI,pd_scratch,512); pi_read_block(PI,pd_scratch,512);
pi_disconnect(PI); pi_disconnect(PI);
PD.sectors = word_val(6); PD.can_lba = pd_scratch[99] & 2;
PD.heads = word_val(3); PD.sectors = le16_to_cpu(*(u16*)(pd_scratch+12));
PD.cylinders = word_val(1); PD.heads = le16_to_cpu(*(u16*)(pd_scratch+6));
PD.cylinders = le16_to_cpu(*(u16*)(pd_scratch+2));
if (PD.can_lba)
PD.capacity = le32_to_cpu(*(u32*)(pd_scratch + 120));
else
PD.capacity = PD.sectors*PD.heads*PD.cylinders; PD.capacity = PD.sectors*PD.heads*PD.cylinders;
for(j=0;j<PD_ID_LEN;j++) id[j^1] = pd_scratch[j+PD_ID_OFF]; for(j=0;j<PD_ID_LEN;j++) id[j^1] = pd_scratch[j+PD_ID_OFF];
...@@ -1012,6 +934,50 @@ static void do_pd_write_done( void ) ...@@ -1012,6 +934,50 @@ static void do_pd_write_done( void )
spin_unlock_irqrestore(&pd_lock,saved_flags); spin_unlock_irqrestore(&pd_lock,saved_flags);
} }
/* end of pd.c */ static int __init pd_init(void)
{
request_queue_t * q;
int unit;
if (disable) return -1;
if (devfs_register_blkdev(MAJOR_NR,name,&pd_fops)) {
printk("%s: unable to get major number %d\n",
name,major);
return -1;
}
q = BLK_DEFAULT_QUEUE(MAJOR_NR);
blk_init_queue(q, do_pd_request, &pd_lock);
blk_queue_max_sectors(q, cluster);
pd_gendisk.major = major;
pd_gendisk.major_name = name;
add_gendisk(&pd_gendisk);
printk("%s: %s version %s, major %d, cluster %d, nice %d\n",
name,name,PD_VERSION,major,cluster,nice);
pd_init_units();
pd_gendisk.nr_real = pd_detect();
if (!pd_gendisk.nr_real) {
devfs_unregister_blkdev(MAJOR_NR, name);
del_gendisk(&pd_gendisk);
for (unit=0; unit<PD_UNITS; unit++)
if (PD.present)
pi_release(PI);
return -1;
}
return 0;
}
static void __exit pd_exit(void)
{
int unit;
devfs_unregister_blkdev(MAJOR_NR, name);
del_gendisk(&pd_gendisk);
for (unit=0; unit<PD_UNITS; unit++)
if (PD.present)
pi_release(PI);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(pd_init)
module_exit(pd_exit)
...@@ -153,11 +153,9 @@ static int pf_drive_count; ...@@ -153,11 +153,9 @@ static int pf_drive_count;
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/init.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/genhd.h>
#include <linux/hdreg.h> #include <linux/hdreg.h>
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -240,7 +238,6 @@ MODULE_PARM(drive3,"1-7i"); ...@@ -240,7 +238,6 @@ MODULE_PARM(drive3,"1-7i");
#define ATAPI_READ_10 0x28 #define ATAPI_READ_10 0x28
#define ATAPI_WRITE_10 0x2a #define ATAPI_WRITE_10 0x2a
int pf_init(void);
#ifdef MODULE #ifdef MODULE
void cleanup_module( void ); void cleanup_module( void );
#endif #endif
...@@ -337,34 +334,6 @@ void pf_init_units( void ) ...@@ -337,34 +334,6 @@ void pf_init_units( void )
} }
} }
int pf_init (void) /* preliminary initialisation */
{ int i;
request_queue_t * q;
if (disable) return -1;
pf_init_units();
if (pf_detect()) return -1;
pf_busy = 0;
if (register_blkdev(MAJOR_NR,name,&pf_fops)) {
printk("pf_init: unable to get major number %d\n",
major);
return -1;
}
q = BLK_DEFAULT_QUEUE(MAJOR_NR);
blk_init_queue(q, do_pf_request, &pf_spin_lock);
blk_queue_max_phys_segments(q, cluster);
blk_queue_max_hw_segments(q, cluster);
for (i=0;i<PF_UNITS;i++)
register_disk(NULL, mk_kdev(MAJOR_NR, i), 1, &pf_fops, 0);
return 0;
}
static int pf_open (struct inode *inode, struct file *file) static int pf_open (struct inode *inode, struct file *file)
{ int unit = DEVICE_NR(inode->i_rdev); { int unit = DEVICE_NR(inode->i_rdev);
...@@ -454,39 +423,6 @@ static int pf_check_media( kdev_t dev) ...@@ -454,39 +423,6 @@ static int pf_check_media( kdev_t dev)
{ return 1; { return 1;
} }
#ifdef MODULE
/* Glue for modules ... */
void cleanup_module(void);
int init_module(void)
{ int err;
#ifdef PARIDE_JUMBO
{ extern paride_init();
paride_init();
}
#endif
err = pf_init();
return err;
}
void cleanup_module(void)
{ int unit;
unregister_blkdev(MAJOR_NR,name);
for (unit=0;unit<PF_UNITS;unit++)
if (PF.present) pi_release(PI);
}
#endif
#define WR(c,r,v) pi_write_regr(PI,c,r,v) #define WR(c,r,v) pi_write_regr(PI,c,r,v)
#define RR(c,r) (pi_read_regr(PI,c,r)) #define RR(c,r) (pi_read_regr(PI,c,r))
...@@ -1036,6 +972,44 @@ static void do_pf_write_done( void ) ...@@ -1036,6 +972,44 @@ static void do_pf_write_done( void )
spin_unlock_irqrestore(&pf_spin_lock,saved_flags); spin_unlock_irqrestore(&pf_spin_lock,saved_flags);
} }
/* end of pf.c */ static int __init pf_init(void) /* preliminary initialisation */
{
int i;
request_queue_t * q;
if (disable)
return -1;
pf_init_units();
if (pf_detect())
return -1;
pf_busy = 0;
if (register_blkdev(MAJOR_NR,name,&pf_fops)) {
printk("pf_init: unable to get major number %d\n", major);
return -1;
}
q = BLK_DEFAULT_QUEUE(MAJOR_NR);
blk_init_queue(q, do_pf_request, &pf_spin_lock);
blk_queue_max_phys_segments(q, cluster);
blk_queue_max_hw_segments(q, cluster);
for (i=0;i<PF_UNITS;i++)
register_disk(NULL, mk_kdev(MAJOR_NR, i), 1, &pf_fops, 0);
return 0;
}
static void __exit pf_exit(void)
{
int unit;
unregister_blkdev(MAJOR_NR,name);
for (unit=0;unit<PF_UNITS;unit++)
if (PF.present)
pi_release(PI);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(pf_init)
module_exit(pf_exit)
...@@ -162,16 +162,13 @@ static int pg_drive_count; ...@@ -162,16 +162,13 @@ static int pg_drive_count;
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/init.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#include <linux/kernel.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/mtio.h> #include <linux/mtio.h>
#include <linux/pg.h> #include <linux/pg.h>
#include <linux/wait.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -218,11 +215,6 @@ MODULE_PARM(drive3,"1-6i"); ...@@ -218,11 +215,6 @@ MODULE_PARM(drive3,"1-6i");
#define ATAPI_IDENTIFY 0x12 #define ATAPI_IDENTIFY 0x12
int pg_init(void);
#ifdef MODULE
void cleanup_module( void );
#endif
static int pg_open(struct inode *inode, struct file *file); static int pg_open(struct inode *inode, struct file *file);
static int pg_release (struct inode *inode, struct file *file); static int pg_release (struct inode *inode, struct file *file);
static ssize_t pg_read(struct file * filp, char * buf, static ssize_t pg_read(struct file * filp, char * buf,
...@@ -291,64 +283,6 @@ void pg_init_units( void ) ...@@ -291,64 +283,6 @@ void pg_init_units( void )
static devfs_handle_t devfs_handle; static devfs_handle_t devfs_handle;
int pg_init (void) /* preliminary initialisation */
{ int unit;
if (disable) return -1;
pg_init_units();
if (pg_detect()) return -1;
if (devfs_register_chrdev(major,name,&pg_fops)) {
printk("pg_init: unable to get major number %d\n",
major);
for (unit=0;unit<PG_UNITS;unit++)
if (PG.present) pi_release(PI);
return -1;
}
devfs_handle = devfs_mk_dir (NULL, "pg", NULL);
devfs_register_series (devfs_handle, "%u", 4, DEVFS_FL_DEFAULT,
major, 0, S_IFCHR | S_IRUSR | S_IWUSR,
&pg_fops, NULL);
return 0;
}
#ifdef MODULE
/* Glue for modules ... */
void cleanup_module(void);
int init_module(void)
{ int err;
#ifdef PARIDE_JUMBO
{ extern paride_init();
paride_init();
}
#endif
err = pg_init();
return err;
}
void cleanup_module(void)
{ int unit;
devfs_unregister (devfs_handle);
devfs_unregister_chrdev(major,name);
for (unit=0;unit<PG_UNITS;unit++)
if (PG.present) pi_release(PI);
}
#endif
#define WR(c,r,v) pi_write_regr(PI,c,r,v) #define WR(c,r,v) pi_write_regr(PI,c,r,v)
#define RR(c,r) (pi_read_regr(PI,c,r)) #define RR(c,r) (pi_read_regr(PI,c,r))
...@@ -691,6 +625,43 @@ static ssize_t pg_read(struct file * filp, char * buf, ...@@ -691,6 +625,43 @@ static ssize_t pg_read(struct file * filp, char * buf,
return copy+hs; return copy+hs;
} }
/* end of pg.c */ static int __init pg_init(void)
{
int unit;
if (disable)
return -1;
pg_init_units();
if (pg_detect())
return -1;
if (devfs_register_chrdev(major,name,&pg_fops)) {
printk("pg_init: unable to get major number %d\n",
major);
for (unit=0;unit<PG_UNITS;unit++)
if (PG.present) pi_release(PI);
return -1;
}
devfs_handle = devfs_mk_dir (NULL, "pg", NULL);
devfs_register_series (devfs_handle, "%u", 4, DEVFS_FL_DEFAULT,
major, 0, S_IFCHR | S_IRUSR | S_IWUSR,
&pg_fops, NULL);
return 0;
}
static void __exit pg_exit(void)
{
int unit;
devfs_unregister (devfs_handle);
devfs_unregister_chrdev(major,name);
for (unit=0;unit<PG_UNITS;unit++)
if (PG.present) pi_release(PI);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(pg_init)
module_exit(pg_exit)
...@@ -141,15 +141,12 @@ static int pt_drive_count; ...@@ -141,15 +141,12 @@ static int pt_drive_count;
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/init.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#include <linux/kernel.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/mtio.h> #include <linux/mtio.h>
#include <linux/wait.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -209,11 +206,6 @@ MODULE_PARM(drive3,"1-6i"); ...@@ -209,11 +206,6 @@ MODULE_PARM(drive3,"1-6i");
#define ATAPI_MODE_SENSE 0x1a #define ATAPI_MODE_SENSE 0x1a
#define ATAPI_LOG_SENSE 0x4d #define ATAPI_LOG_SENSE 0x4d
int pt_init(void);
#ifdef MODULE
void cleanup_module( void );
#endif
static int pt_open(struct inode *inode, struct file *file); static int pt_open(struct inode *inode, struct file *file);
static int pt_ioctl(struct inode *inode,struct file *file, static int pt_ioctl(struct inode *inode,struct file *file,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
...@@ -295,68 +287,6 @@ void pt_init_units( void ) ...@@ -295,68 +287,6 @@ void pt_init_units( void )
static devfs_handle_t devfs_handle; static devfs_handle_t devfs_handle;
int pt_init (void) /* preliminary initialisation */
{ int unit;
if (disable) return -1;
pt_init_units();
if (pt_detect()) return -1;
if (devfs_register_chrdev(major,name,&pt_fops)) {
printk("pt_init: unable to get major number %d\n",
major);
for (unit=0;unit<PT_UNITS;unit++)
if (PT.present) pi_release(PI);
return -1;
}
devfs_handle = devfs_mk_dir (NULL, "pt", NULL);
devfs_register_series (devfs_handle, "%u", 4, DEVFS_FL_DEFAULT,
major, 0, S_IFCHR | S_IRUSR | S_IWUSR,
&pt_fops, NULL);
devfs_register_series (devfs_handle, "%un", 4, DEVFS_FL_DEFAULT,
major, 128, S_IFCHR | S_IRUSR | S_IWUSR,
&pt_fops, NULL);
return 0;
}
#ifdef MODULE
/* Glue for modules ... */
void cleanup_module(void);
int init_module(void)
{ int err;
#ifdef PARIDE_JUMBO
{ extern paride_init();
paride_init();
}
#endif
err = pt_init();
return err;
}
void cleanup_module(void)
{ int unit;
devfs_unregister (devfs_handle);
devfs_unregister_chrdev(major,name);
for (unit=0;unit<PT_UNITS;unit++)
if (PT.present) pi_release(PI);
}
#endif
#define WR(c,r,v) pi_write_regr(PI,c,r,v) #define WR(c,r,v) pi_write_regr(PI,c,r,v)
#define RR(c,r) (pi_read_regr(PI,c,r)) #define RR(c,r) (pi_read_regr(PI,c,r))
...@@ -965,6 +895,46 @@ static ssize_t pt_write(struct file * filp, const char * buf, ...@@ -965,6 +895,46 @@ static ssize_t pt_write(struct file * filp, const char * buf,
return t; return t;
} }
/* end of pt.c */ static int __init pt_init(void)
{
int unit;
if (disable)
return -1;
pt_init_units();
if (pt_detect())
return -1;
if (devfs_register_chrdev(major,name,&pt_fops)) {
printk("pt_init: unable to get major number %d\n",
major);
for (unit=0;unit<PT_UNITS;unit++)
if (PT.present) pi_release(PI);
return -1;
}
devfs_handle = devfs_mk_dir (NULL, "pt", NULL);
devfs_register_series (devfs_handle, "%u", 4, DEVFS_FL_DEFAULT,
major, 0, S_IFCHR | S_IRUSR | S_IWUSR,
&pt_fops, NULL);
devfs_register_series (devfs_handle, "%un", 4, DEVFS_FL_DEFAULT,
major, 128, S_IFCHR | S_IRUSR | S_IWUSR,
&pt_fops, NULL);
return 0;
}
static void __exit pt_exit(void)
{
int unit;
devfs_unregister (devfs_handle);
devfs_unregister_chrdev(major,name);
for (unit=0;unit<PT_UNITS;unit++)
if (PT.present)
pi_release(PI);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(pt_init)
module_exit(pt_exit)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment