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 @@
# 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_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_BPCK) += bpck.o
obj-$(CONFIG_PARIDE_COMM) += comm.o
......@@ -20,13 +15,18 @@ obj-$(CONFIG_PARIDE_DSTR) += dstr.o
obj-$(CONFIG_PARIDE_KBIC) += kbic.o
obj-$(CONFIG_PARIDE_EPAT) += epat.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_FRIQ) += friq.o
obj-$(CONFIG_PARIDE_FIT2) += fit2.o
obj-$(CONFIG_PARIDE_FIT3) += fit3.o
obj-$(CONFIG_PARIDE_ON20) += on20.o
obj-$(CONFIG_PARIDE_ON26) += on26.o
obj-$(CONFIG_PARIDE_KTTI) += ktti.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
......@@ -18,6 +18,7 @@
#define ATEN_VERSION "1.01"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/wait.h>
......@@ -140,35 +141,33 @@ static void aten_release_proto( PIA *pi )
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol aten = {"aten",0,2,2,1,1,
aten_write_regr,
aten_read_regr,
aten_write_block,
aten_read_block,
aten_connect,
aten_disconnect,
0,
0,
0,
aten_log_adapter,
aten_init_proto,
aten_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register( &aten ) - 1;
static struct pi_protocol aten = {
.name = "aten",
.max_mode = 2,
.epp_first = 2,
.default_delay = 1,
.max_units = 1,
.write_regr = aten_write_regr,
.read_regr = aten_read_regr,
.write_block = aten_write_block,
.read_block = aten_read_block,
.connect = aten_connect,
.disconnect = aten_disconnect,
.log_adapter = aten_log_adapter,
.init_proto = aten_init_proto,
.release_proto = aten_release_proto,
};
static int __init aten_init(void)
{
return pi_register(&aten)-1;
}
void cleanup_module(void)
{ pi_unregister( &aten );
static void __exit aten_exit(void)
{
pi_unregister( &aten );
}
#endif
/* end of aten.c */
MODULE_LICENSE("GPL");
module_init(aten_init)
module_exit(aten_exit)
......@@ -17,6 +17,7 @@
#define BPCK_VERSION "1.02"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -452,34 +453,36 @@ static void bpck_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol bpck = { "bpck",0,5,2,4,256,
bpck_write_regr,
bpck_read_regr,
bpck_write_block,
bpck_read_block,
bpck_connect,
bpck_disconnect,
bpck_test_port,
bpck_probe_unit,
bpck_test_proto,
bpck_log_adapter,
bpck_init_proto,
bpck_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register(&bpck) - 1;
static struct pi_protocol bpck = {
.name = "bpck",
.max_mode = 5,
.epp_first = 2,
.default_delay = 4,
.max_units = 255,
.write_regr = bpck_write_regr,
.read_regr = bpck_read_regr,
.write_block = bpck_write_block,
.read_block = bpck_read_block,
.connect = bpck_connect,
.disconnect = bpck_disconnect,
.test_port = bpck_test_port,
.probe_unit = bpck_probe_unit,
.test_proto = bpck_test_proto,
.log_adapter = bpck_log_adapter,
.init_proto = bpck_init_proto,
.release_proto = bpck_release_proto,
};
static int __init bpck_init(void)
{
return pi_register(&bpck)-1;
}
void cleanup_module(void)
{ pi_unregister(&bpck);
static void __exit bpck_exit(void)
{
pi_unregister(&bpck);
}
#endif
/* end of bpck.c */
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 */
#define BACKPACK_VERSION "2.0.2"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/types.h>
......@@ -252,65 +253,41 @@ static void bpck6_release_proto(PIA *pi)
kfree((void *)(pi->private));
}
struct pi_protocol bpck6 = { "bpck6", /* name for proto*/
0, /* index into proto table */
5, /* max mode =5 */
2, /* 2-5 use epp (need 8 ports) */
0, /* no delay (not used anyway) */
255, /* we can have units up to 255 */
bpck6_write_regr,
bpck6_read_regr,
bpck6_write_block,
bpck6_read_block,
bpck6_connect,
bpck6_disconnect,
bpck6_test_port,
bpck6_probe_unit,
0,
bpck6_log_adapter,
bpck6_init_proto,
bpck6_release_proto
};
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)
static struct pi_protocol bpck6 = {
.name = "bpck6",
.max_mode = 5,
.epp_first = 2, /* 2-5 use epp (need 8 ports) */
.max_units = 255,
.write_regr = bpck6_write_regr,
.read_regr = bpck6_read_regr,
.write_block = bpck6_write_block,
.read_block = bpck6_read_block,
.connect = bpck6_connect,
.disconnect = bpck6_disconnect,
.test_port = bpck6_test_port,
.probe_unit = bpck6_probe_unit,
.log_adapter = bpck6_log_adapter,
.init_proto = bpck6_init_proto,
.release_proto = bpck6_release_proto,
};
static int __init bpck6_init(void)
{
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");
if(verbose)
{
printk(KERN_DEBUG "bpck6: verbose debug enabled.\n");
}
return pi_register(&bpck6) - 1;
}
void cleanup_module(void)
static void __exit bpck6_exit(void)
{
pi_unregister(&bpck6);
}
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Micro Solutions Inc.");
MODULE_DESCRIPTION("BACKPACK Protocol module, compatible with PARIDE");
MODULE_PARM(verbose,"i");
#endif
module_init(bpck6_init)
module_exit(bpck6_exit)
......@@ -17,6 +17,7 @@
#define COMM_VERSION "1.01"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -196,35 +197,33 @@ static void comm_release_proto(PIA *pi)
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol comm = {"comm",0,5,2,1,1,
comm_write_regr,
comm_read_regr,
comm_write_block,
comm_read_block,
comm_connect,
comm_disconnect,
0,
0,
0,
comm_log_adapter,
comm_init_proto,
comm_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register( &comm ) - 1;
static struct pi_protocol comm = {
.name = "comm",
.max_mode = 5,
.epp_first = 2,
.default_delay = 1,
.max_units = 1,
.write_regr = comm_write_regr,
.read_regr = comm_read_regr,
.write_block = comm_write_block,
.read_block = comm_read_block,
.connect = comm_connect,
.disconnect = comm_disconnect,
.log_adapter = comm_log_adapter,
.init_proto = comm_init_proto,
.release_proto = comm_release_proto,
};
static int __init comm_init(void)
{
return pi_register(&comm)-1;
}
void cleanup_module(void)
{ pi_unregister( &comm );
static void __exit comm_exit(void)
{
pi_unregister(&comm);
}
#endif
/* end of comm.c */
MODULE_LICENSE("GPL");
module_init(comm_init)
module_exit(comm_exit)
......@@ -16,6 +16,7 @@
#define DSTR_VERSION "1.01"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -211,35 +212,33 @@ static void dstr_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol dstr = {"dstr",0,5,2,1,1,
dstr_write_regr,
dstr_read_regr,
dstr_write_block,
dstr_read_block,
dstr_connect,
dstr_disconnect,
0,
0,
0,
dstr_log_adapter,
dstr_init_proto,
dstr_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register( &dstr ) - 1;
static struct pi_protocol dstr = {
.name = "dstr",
.max_mode = 5,
.epp_first = 2,
.default_delay = 1,
.max_units = 1,
.write_regr = dstr_write_regr,
.read_regr = dstr_read_regr,
.write_block = dstr_write_block,
.read_block = dstr_read_block,
.connect = dstr_connect,
.disconnect = dstr_disconnect,
.log_adapter = dstr_log_adapter,
.init_proto = dstr_init_proto,
.release_proto = dstr_release_proto,
};
static int __init dstr_init(void)
{
return pi_register(&dstr)-1;
}
void cleanup_module(void)
{ pi_unregister( &dstr );
static void __exit dstr_exit(void)
{
pi_unregister(&dstr);
}
#endif
/* end of dstr.c */
MODULE_LICENSE("GPL");
module_init(dstr_init)
module_exit(dstr_exit)
......@@ -19,6 +19,7 @@
#define EPAT_VERSION "1.02"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -311,35 +312,34 @@ static void epat_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol epat = {"epat",0,6,3,1,1,
epat_write_regr,
epat_read_regr,
epat_write_block,
epat_read_block,
epat_connect,
epat_disconnect,
0,
0,
epat_test_proto,
epat_log_adapter,
epat_init_proto,
epat_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register( &epat) - 1;
static struct pi_protocol epat = {
.name = "epat",
.max_mode = 6,
.epp_first = 3,
.default_delay = 1,
.max_units = 1,
.write_regr = epat_write_regr,
.read_regr = epat_read_regr,
.write_block = epat_write_block,
.read_block = epat_read_block,
.connect = epat_connect,
.disconnect = epat_disconnect,
.test_proto = epat_test_proto,
.log_adapter = epat_log_adapter,
.init_proto = epat_init_proto,
.release_proto = epat_release_proto,
};
static int __init epat_init(void)
{
return pi_register(&epat)-1;
}
void cleanup_module(void)
{ pi_unregister( &epat);
static void __exit epat_exit(void)
{
pi_unregister(&epat);
}
#endif
/* end of epat.c */
MODULE_LICENSE("GPL");
module_init(epat_init)
module_exit(epat_exit)
......@@ -20,6 +20,7 @@
#define EPIA_VERSION "1.02"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -293,36 +294,34 @@ static void epia_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol epia = {"epia",0,6,3,1,1,
epia_write_regr,
epia_read_regr,
epia_write_block,
epia_read_block,
epia_connect,
epia_disconnect,
0,
0,
epia_test_proto,
epia_log_adapter,
epia_init_proto,
epia_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register( &epia ) - 1;
static struct pi_protocol epia = {
.name = "epia",
.max_mode = 6,
.epp_first = 3,
.default_delay = 1,
.max_units = 1,
.write_regr = epia_write_regr,
.read_regr = epia_read_regr,
.write_block = epia_write_block,
.read_block = epia_read_block,
.connect = epia_connect,
.disconnect = epia_disconnect,
.test_proto = epia_test_proto,
.log_adapter = epia_log_adapter,
.init_proto = epia_init_proto,
.release_proto = epia_release_proto,
};
static int __init epia_init(void)
{
return pi_register(&epia)-1;
}
void cleanup_module(void)
{ pi_unregister( &epia );
static void __exit epia_exit(void)
{
pi_unregister(&epia);
}
#endif
/* end of epia.c */
MODULE_LICENSE("GPL");
module_init(epia_init)
module_exit(epia_exit)
......@@ -16,6 +16,7 @@
#define FIT2_VERSION "1.0"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -129,35 +130,33 @@ static void fit2_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol fit2 = {"fit2",0,1,2,1,1,
fit2_write_regr,
fit2_read_regr,
fit2_write_block,
fit2_read_block,
fit2_connect,
fit2_disconnect,
0,
0,
0,
fit2_log_adapter,
fit2_init_proto,
fit2_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register( &fit2 ) - 1;
static struct pi_protocol fit2 = {
.name = "fit2",
.max_mode = 1,
.epp_first = 2,
.default_delay = 1,
.max_units = 1,
.write_regr = fit2_write_regr,
.read_regr = fit2_read_regr,
.write_block = fit2_write_block,
.read_block = fit2_read_block,
.connect = fit2_connect,
.disconnect = fit2_disconnect,
.log_adapter = fit2_log_adapter,
.init_proto = fit2_init_proto,
.release_proto = fit2_release_proto,
};
static int __init fit2_init(void)
{
return pi_register(&fit2)-1;
}
void cleanup_module(void)
{ pi_unregister( &fit2 );
static void __exit fit2_exit(void)
{
pi_unregister(&fit2);
}
#endif
/* end of fit2.c */
MODULE_LICENSE("GPL");
module_init(fit2_init)
module_exit(fit2_exit)
......@@ -20,6 +20,7 @@
#define FIT3_VERSION "1.0"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -189,35 +190,33 @@ static void fit3_release_proto(PIA *pi)
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol fit3 = {"fit3",0,3,2,1,1,
fit3_write_regr,
fit3_read_regr,
fit3_write_block,
fit3_read_block,
fit3_connect,
fit3_disconnect,
0,
0,
0,
fit3_log_adapter,
fit3_init_proto,
fit3_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register( &fit3 ) - 1;
static struct pi_protocol fit3 = {
.name = "fit3",
.max_mode = 3,
.epp_first = 2,
.default_delay = 1,
.max_units = 1,
.write_regr = fit3_write_regr,
.read_regr = fit3_read_regr,
.write_block = fit3_write_block,
.read_block = fit3_read_block,
.connect = fit3_connect,
.disconnect = fit3_disconnect,
.log_adapter = fit3_log_adapter,
.init_proto = fit3_init_proto,
.release_proto = fit3_release_proto,
};
static int __init fit3_init(void)
{
return pi_register(&fit3)-1;
}
void cleanup_module(void)
{ pi_unregister( &fit3 );
static void __exit fit3_exit(void)
{
pi_unregister(&fit3);
}
#endif
/* end of fit3.c */
MODULE_LICENSE("GPL");
module_init(fit3_init)
module_exit(fit3_exit)
......@@ -28,6 +28,7 @@
#define FRIQ_VERSION "1.01"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -250,35 +251,34 @@ static void friq_release_proto( PIA *pi)
MOD_DEC_USE_COUNT;
}
struct pi_protocol friq = {"friq",0,5,2,1,1,
friq_write_regr,
friq_read_regr,
friq_write_block,
friq_read_block,
friq_connect,
friq_disconnect,
0,
0,
friq_test_proto,
friq_log_adapter,
friq_init_proto,
friq_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register( &friq ) - 1;
static struct pi_protocol friq = {
.name = "friq",
.max_mode = 5,
.epp_first = 2,
.default_delay = 1,
.max_units = 1,
.write_regr = friq_write_regr,
.read_regr = friq_read_regr,
.write_block = friq_write_block,
.read_block = friq_read_block,
.connect = friq_connect,
.disconnect = friq_disconnect,
.test_proto = friq_test_proto,
.log_adapter = friq_log_adapter,
.init_proto = friq_init_proto,
.release_proto = friq_release_proto,
};
static int __init friq_init(void)
{
return pi_register(&friq)-1;
}
void cleanup_module(void)
{ pi_unregister( &friq );
static void __exit friq_exit(void)
{
pi_unregister(&friq);
}
#endif
/* end of friq.c */
MODULE_LICENSE("GPL");
module_init(friq_init)
module_exit(friq_exit)
......@@ -26,6 +26,7 @@
#define FRPW_VERSION "1.03"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -291,35 +292,34 @@ static void frpw_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol frpw = {"frpw",0,6,2,2,1,
frpw_write_regr,
frpw_read_regr,
frpw_write_block,
frpw_read_block,
frpw_connect,
frpw_disconnect,
0,
0,
frpw_test_proto,
frpw_log_adapter,
frpw_init_proto,
frpw_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register( &frpw ) - 1;
static struct pi_protocol frpw = {
.name = "frpw",
.max_mode = 6,
.epp_first = 2,
.default_delay = 2,
.max_units = 1,
.write_regr = frpw_write_regr,
.read_regr = frpw_read_regr,
.write_block = frpw_write_block,
.read_block = frpw_read_block,
.connect = frpw_connect,
.disconnect = frpw_disconnect,
.test_proto = frpw_test_proto,
.log_adapter = frpw_log_adapter,
.init_proto = frpw_init_proto,
.release_proto = frpw_release_proto,
};
static int __init frpw_init(void)
{
return pi_register(&frpw)-1;
}
void cleanup_module(void)
{ pi_unregister( &frpw );
static void __exit frpw_exit(void)
{
pi_unregister(&frpw);
}
#endif
/* end of frpw.c */
MODULE_LICENSE("GPL");
module_init(frpw_init)
module_exit(frpw_exit)
......@@ -21,6 +21,7 @@
#define KBIC_VERSION "1.01"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -258,56 +259,51 @@ static void kbic_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol k951 = {"k951",0,6,3,1,1,
kbic_write_regr,
kbic_read_regr,
kbic_write_block,
kbic_read_block,
k951_connect,
k951_disconnect,
0,
0,
0,
k951_log_adapter,
kbic_init_proto,
kbic_release_proto
};
struct pi_protocol k971 = {"k971",0,6,3,1,1,
kbic_write_regr,
kbic_read_regr,
kbic_write_block,
kbic_read_block,
k971_connect,
k971_disconnect,
0,
0,
0,
k971_log_adapter,
kbic_init_proto,
kbic_release_proto
};
#ifdef MODULE
int init_module(void)
{ int s5,s7;
s5 = pi_register(&k951);
s7 = pi_register(&k971);
return (s5 || s7) - 1;
static struct pi_protocol k951 = {
.name = "k951",
.max_mode = 6,
.epp_first = 3,
.default_delay = 1,
.max_units = 1,
.write_regr = kbic_write_regr,
.read_regr = kbic_read_regr,
.write_block = kbic_write_block,
.read_block = kbic_read_block,
.connect = k951_connect,
.disconnect = k951_disconnect,
.log_adapter = k951_log_adapter,
.init_proto = kbic_init_proto,
.release_proto = kbic_release_proto
};
static struct pi_protocol k971 = {
.name = "k971",
.max_mode = 6,
.epp_first = 3,
.default_delay = 1,
.max_units = 1,
.write_regr = kbic_write_regr,
.read_regr = kbic_read_regr,
.write_block = kbic_write_block,
.read_block = kbic_read_block,
.connect = k971_connect,
.disconnect = k971_disconnect,
.log_adapter = k971_log_adapter,
.init_proto = kbic_init_proto,
.release_proto = kbic_release_proto
};
static int __init kbic_init(void)
{
return (pi_register(&k951)||pi_register(&k971))-1;
}
void cleanup_module(void)
{ pi_unregister( &k951 );
pi_unregister( &k971 );
static void __exit kbic_exit(void)
{
pi_unregister(&k951);
pi_unregister(&k971);
}
#endif
/* end of kbic.c */
MODULE_LICENSE("GPL");
module_init(kbic_init)
module_exit(kbic_exit)
......@@ -12,6 +12,7 @@
#define KTTI_VERSION "1.0"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -106,35 +107,33 @@ static void ktti_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol ktti = {"ktti",0,1,2,1,1,
ktti_write_regr,
ktti_read_regr,
ktti_write_block,
ktti_read_block,
ktti_connect,
ktti_disconnect,
0,
0,
0,
ktti_log_adapter,
ktti_init_proto,
ktti_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register( &ktti ) - 1;
static struct pi_protocol ktti = {
.name = "ktti",
.max_mode = 1,
.epp_first = 2,
.default_delay = 1,
.max_units = 1,
.write_regr = ktti_write_regr,
.read_regr = ktti_read_regr,
.write_block = ktti_write_block,
.read_block = ktti_read_block,
.connect = ktti_connect,
.disconnect = ktti_disconnect,
.log_adapter = ktti_log_adapter,
.init_proto = ktti_init_proto,
.release_proto = ktti_release_proto,
};
static int __init ktti_init(void)
{
return pi_register(&ktti)-1;
}
void cleanup_module(void)
{ pi_unregister( &ktti );
static void __exit ktti_exit(void)
{
pi_unregister(&ktti);
}
#endif
/* end of ktti.c */
MODULE_LICENSE("GPL");
module_init(ktti_init)
module_exit(ktti_exit)
......@@ -15,6 +15,7 @@
#define ON20_VERSION "1.01"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -131,35 +132,33 @@ static void on20_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol on20 = {"on20",0,2,2,1,1,
on20_write_regr,
on20_read_regr,
on20_write_block,
on20_read_block,
on20_connect,
on20_disconnect,
0,
0,
0,
on20_log_adapter,
on20_init_proto,
on20_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register( &on20 ) - 1;
static struct pi_protocol on20 = {
.name = "on20",
.max_mode = 2,
.epp_first = 2,
.default_delay = 1,
.max_units = 1,
.write_regr = on20_write_regr,
.read_regr = on20_read_regr,
.write_block = on20_write_block,
.read_block = on20_read_block,
.connect = on20_connect,
.disconnect = on20_disconnect,
.log_adapter = on20_log_adapter,
.init_proto = on20_init_proto,
.release_proto = on20_release_proto,
};
static int __init on20_init(void)
{
return pi_register(&on20)-1;
}
void cleanup_module(void)
{ pi_unregister( &on20 );
static void __exit on20_exit(void)
{
pi_unregister(&on20);
}
#endif
/* end of on20.c */
MODULE_LICENSE("GPL");
module_init(on20_init)
module_exit(on20_exit)
......@@ -19,6 +19,7 @@
#define ON26_VERSION "1.04"
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/types.h>
......@@ -296,36 +297,34 @@ static void on26_release_proto( PIA *pi)
{ MOD_DEC_USE_COUNT;
}
struct pi_protocol on26 = {"on26",0,5,2,1,1,
on26_write_regr,
on26_read_regr,
on26_write_block,
on26_read_block,
on26_connect,
on26_disconnect,
on26_test_port,
0,
0,
on26_log_adapter,
on26_init_proto,
on26_release_proto
};
#ifdef MODULE
int init_module(void)
{ return pi_register( &on26 ) - 1;
static struct pi_protocol on26 = {
.name = "on26",
.max_mode = 5,
.epp_first = 2,
.default_delay = 1,
.max_units = 1,
.write_regr = on26_write_regr,
.read_regr = on26_read_regr,
.write_block = on26_write_block,
.read_block = on26_read_block,
.connect = on26_connect,
.disconnect = on26_disconnect,
.test_port = on26_test_port,
.log_adapter = on26_log_adapter,
.init_proto = on26_init_proto,
.release_proto = on26_release_proto,
};
static int __init on26_init(void)
{
return pi_register(&on26)-1;
}
void cleanup_module(void)
{ pi_unregister( &on26 );
static void __exit on26_exit(void)
{
pi_unregister(&on26);
}
#endif
/* end of on26.c */
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,
}
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;
/* end of parameters */
#include <linux/module.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/kernel.h>
......@@ -200,9 +201,6 @@ MODULE_PARM(drive3,"1-6i");
#define IDE_READY 0x40
#define IDE_BUSY 0x80
int pcd_init(void);
void cleanup_module( void );
static int pcd_open(struct cdrom_device_info *cdi, int purpose);
static void pcd_release(struct cdrom_device_info *cdi);
static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr);
......@@ -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)
{ int unit = DEVICE_NR(cdi->dev);
if ((unit >= PCD_UNITS) || (!PCD.present)) return -ENODEV;
{
int unit = DEVICE_NR(cdi->dev);
if ((unit >= PCD_UNITS) || (!PCD.present))
return -ENODEV;
return 0;
}
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 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)
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_init(pcd_init)
module_exit(pcd_exit)
......@@ -153,16 +153,12 @@ static int pd_drive_count;
/* end of parameters */
#include <linux/init.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/genhd.h>
#include <linux/hdreg.h>
#include <linux/cdrom.h> /* for the eject ioctl */
#include <linux/spinlock.h>
#include <asm/uaccess.h>
......@@ -181,8 +177,8 @@ static STT pd_stt[7] = {{"drive0",8,drive0},
{"nice",1,&nice}};
void pd_setup( char *str, int *ints)
{ generic_setup(pd_stt,7,str);
{
generic_setup(pd_stt,7,str);
}
#endif
......@@ -199,19 +195,15 @@ MODULE_PARM(drive3,"1-8i");
#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 DEVICE_NR(device) (minor(device)>>PD_BITS)
#define DEVICE_OFF(device)
#include <linux/blk.h>
#include <linux/blkpg.h>
#include "pseudo.h"
#define PD_BITS 4
#define DEVICE_NR(device) (minor(device)>>PD_BITS)
#define PD_PARTNS (1<<PD_BITS)
#define PD_DEVS PD_PARTNS*PD_UNITS
......@@ -258,11 +250,7 @@ MODULE_PARM(drive3,"1-8i");
#define IDE_IDENTIFY 0xec
#define IDE_EJECT 0xed
int pd_init(void);
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 void do_pd_request(request_queue_t * q);
static int pd_ioctl(struct inode *inode,struct file *file,
......@@ -296,6 +284,7 @@ struct pd_unit {
int heads; /* physical geometry */
int sectors;
int cylinders;
int can_lba;
int drive; /* master=0 slave=1 */
int changed; /* Have we seen a disk change ? */
int removable; /* removable media device ? */
......@@ -303,7 +292,7 @@ struct pd_unit {
int alt_geom;
int present;
char name[PD_NAMELEN]; /* pda, pdb, etc ... */
};
};
struct pd_unit pd[PD_UNITS];
......@@ -312,7 +301,6 @@ struct pd_unit pd[PD_UNITS];
#define PD pd[unit]
#define PI PD.pi
static int pd_valid = 1; /* serialise partition checks */
static char pd_scratch[512]; /* scratch block buffer */
/* the variables below are used mainly in the I/O request engine, which
......@@ -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)
{
int unit = DEVICE_NR(inode->i_rdev);
......@@ -433,11 +387,8 @@ static int pd_ioctl(struct inode *inode,struct file *file,
unsigned int cmd, unsigned long 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)
return -ENODEV;
......@@ -475,24 +426,19 @@ static int pd_release (struct inode *inode, struct file *file)
{
int unit = DEVICE_NR(inode->i_rdev);
if ((unit >= PD_UNITS) || (PD.access <= 0))
return -EINVAL;
PD.access--;
if (!PD.access && PD.removable)
if (!--PD.access && PD.removable)
pd_doorlock(unit,IDE_DOORUNLOCK);
return 0;
}
static int pd_check_media( kdev_t dev)
{ int r, unit;
unit = DEVICE_NR(dev);
if ((unit >= PD_UNITS) || (!PD.present)) return -ENODEV;
if (!PD.removable) return 0;
{
int r, unit = DEVICE_NR(dev);
if ((unit >= PD_UNITS) || (!PD.present))
return -ENODEV;
if (!PD.removable)
return 0;
pd_media_check(unit);
r = PD.changed;
PD.changed = 0;
......@@ -521,37 +467,6 @@ static int pd_revalidate(kdev_t dev)
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 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 */
static void pd_send_command( int unit, int n, int s, int h,
int c0, int c1, int func )
{
WR(0,6,DRIVE+h);
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,
}
static void pd_ide_command( int unit, int func, int block, int count )
/* Don't use this call if the capacity is zero. */
{ int c1, c0, h, s;
s = ( block % PD.sectors) + 1;
h = ( block / PD.sectors) % PD.heads;
c0 = ( block / (PD.sectors*PD.heads)) % 256;
c1 = ( block / (PD.sectors*PD.heads*256));
{
int c1, c0, h, s;
if (PD.can_lba) {
s = block & 255;
c0 = (block >>= 8) & 255;
c1 = (block >>= 8) & 255;
h = ((block >>= 8) & 15) + 0x40;
} else {
s = ( block % PD.sectors) + 1;
h = ( block /= PD.sectors) % PD.heads;
c0 = ( block /= PD.heads) % 256;
c1 = (block >>= 8);
}
pd_send_command(unit,count,s,h,c0,c1,func);
}
......@@ -723,10 +641,14 @@ static int pd_identify( int unit )
}
pi_read_block(PI,pd_scratch,512);
pi_disconnect(PI);
PD.sectors = word_val(6);
PD.heads = word_val(3);
PD.cylinders = word_val(1);
PD.capacity = PD.sectors*PD.heads*PD.cylinders;
PD.can_lba = pd_scratch[99] & 2;
PD.sectors = le16_to_cpu(*(u16*)(pd_scratch+12));
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;
for(j=0;j<PD_ID_LEN;j++) id[j^1] = pd_scratch[j+PD_ID_OFF];
j = PD_ID_LEN-1;
......@@ -744,7 +666,7 @@ static int pd_identify( int unit )
if (PD.capacity) pd_init_dev_parms(unit);
if (!PD.standby) pd_standby_off(unit);
return 1;
}
......@@ -1012,6 +934,50 @@ static void do_pd_write_done( void )
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_init(pd_init)
module_exit(pd_exit)
......@@ -153,11 +153,9 @@ static int pf_drive_count;
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/genhd.h>
#include <linux/hdreg.h>
#include <linux/cdrom.h>
#include <linux/spinlock.h>
......@@ -240,7 +238,6 @@ MODULE_PARM(drive3,"1-7i");
#define ATAPI_READ_10 0x28
#define ATAPI_WRITE_10 0x2a
int pf_init(void);
#ifdef MODULE
void cleanup_module( void );
#endif
......@@ -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)
{ int unit = DEVICE_NR(inode->i_rdev);
......@@ -454,39 +423,6 @@ static int pf_check_media( kdev_t dev)
{ 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 RR(c,r) (pi_read_regr(PI,c,r))
......@@ -1036,6 +972,44 @@ static void do_pf_write_done( void )
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_init(pf_init)
module_exit(pf_exit)
......@@ -162,16 +162,13 @@ static int pg_drive_count;
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/mtio.h>
#include <linux/pg.h>
#include <linux/wait.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
......@@ -218,11 +215,6 @@ MODULE_PARM(drive3,"1-6i");
#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_release (struct inode *inode, struct file *file);
static ssize_t pg_read(struct file * filp, char * buf,
......@@ -291,64 +283,6 @@ void pg_init_units( void )
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 RR(c,r) (pi_read_regr(PI,c,r))
......@@ -691,6 +625,43 @@ static ssize_t pg_read(struct file * filp, char * buf,
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_init(pg_init)
module_exit(pg_exit)
......@@ -141,15 +141,12 @@ static int pt_drive_count;
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/mtio.h>
#include <linux/wait.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
......@@ -209,11 +206,6 @@ MODULE_PARM(drive3,"1-6i");
#define ATAPI_MODE_SENSE 0x1a
#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_ioctl(struct inode *inode,struct file *file,
unsigned int cmd, unsigned long arg);
......@@ -291,71 +283,9 @@ void pt_init_units( void )
PT.name[j] = 0;
if (DU[D_PRT]) pt_drive_count++;
}
}
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
static devfs_handle_t devfs_handle;
#define WR(c,r,v) pi_write_regr(PI,c,r,v)
#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,
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_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