Skip to content

Commit

Permalink
[kernel] Add char and network driver init routines to INITPROC
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Aug 25, 2023
1 parent 6490992 commit 07dab55
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 46 deletions.
2 changes: 1 addition & 1 deletion elks/arch/i86/drivers/block/rd.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ static struct file_operations rd_fops = {
rd_release /* release */
};

void rd_init(void)
void INITPROC rd_init(void)
{
if (register_blkdev(MAJOR_NR, DEVICE_NAME, &rd_fops) == 0) {
blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;
Expand Down
2 changes: 1 addition & 1 deletion elks/arch/i86/drivers/block/ssd.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static struct file_operations ssd_fops = {
ssd_release /* release */
};

void ssd_init(void)
void INITPROC ssd_init(void)
{
if (register_blkdev(MAJOR_NR, DEVICE_NAME, &ssd_fops) == 0) {
blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;
Expand Down
11 changes: 2 additions & 9 deletions elks/arch/i86/drivers/char/cgatext.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <linuxmt/cgatext.h>
#include <linuxmt/errno.h>
#include <linuxmt/cgatext.h>
#include <linuxmt/kernel.h>
#include <linuxmt/sched.h>
#include <arch/cgatext.h>
Expand Down Expand Up @@ -90,12 +88,7 @@ static struct file_operations cgatext_fops =
NULL /* release */
};

void
cgatext_init(void)
void INITPROC cgatext_init(void)
{
int i;

i = register_chrdev(CGATEXT_MAJOR, CGATEXT_DEVICE_NAME, &cgatext_fops);
if(i)
printk("cgatext: unable to register: %d\n", i);
register_chrdev(CGATEXT_MAJOR, "cgatext", &cgatext_fops);
}
2 changes: 1 addition & 1 deletion elks/arch/i86/drivers/char/eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static struct file_operations eth_fops = {
eth_release
};

void /*INITPROC*/ eth_init(void)
void INITPROC eth_init(void)
{
register_chrdev(ETH_MAJOR, "eth", &eth_fops);

Expand Down
2 changes: 1 addition & 1 deletion elks/arch/i86/drivers/char/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <linuxmt/types.h>
#include <linuxmt/init.h>

void chr_dev_init(void)
void INITPROC chr_dev_init(void)
{
#ifdef CONFIG_CHAR_DEV_LP
lp_init();
Expand Down
2 changes: 1 addition & 1 deletion elks/arch/i86/drivers/char/lp.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ static struct file_operations lp_fops = {

/*@+type@*/

void lp_init(void)
void INITPROC lp_init(void)
{
register struct lp_info *lp = &ports[0];
int i;
Expand Down
5 changes: 2 additions & 3 deletions elks/arch/i86/drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,9 @@ static struct file_operations memory_fops = {

/*@+type@*/

void mem_dev_init(void)
void INITPROC mem_dev_init(void)
{
if (register_chrdev(MEM_MAJOR, "mem", &memory_fops))
printk("MEM: Unable to get major %d for memory devices\n", MEM_MAJOR);
register_chrdev(MEM_MAJOR, "mem", &memory_fops);
}

#endif
5 changes: 3 additions & 2 deletions elks/arch/i86/drivers/char/meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#ifdef CONFIG_DEV_META

#include <linuxmt/major.h>
#include <linuxmt/init.h>
#include <linuxmt/fs.h>
#include <linuxmt/errno.h>
#include <linuxmt/mm.h>
Expand Down Expand Up @@ -345,9 +346,9 @@ static struct file_operations meta_chr_fops = {
meta_release /* release */
};

void meta_init(void)
void INITPROC meta_init(void)
{
printk("Userspace device driver Copyright (C) 1999 Alistair Riddoch\n");
debug("Userspace device driver Copyright (C) 1999 Alistair Riddoch\n");
if (!register_chrdev(MAJOR_NR, DEVICE_NAME, &meta_chr_fops))
meta_initialised = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion elks/arch/i86/drivers/char/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ struct tty_ops ttyp_ops = {

/*@+type@*/

void pty_init(void)
void INITPROC pty_init(void)
{
register_chrdev(PTY_MASTER_MAJOR, "pty", &pty_fops);
}
Expand Down
2 changes: 1 addition & 1 deletion elks/arch/i86/drivers/char/tcpdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static struct file_operations tcpdev_fops = {

/*@+type@*/

void tcpdev_init(void)
void INITPROC tcpdev_init(void)
{
register_chrdev(TCPDEV_MAJOR, "tcpdev", &tcpdev_fops);
bufin_sem = bufout_sem = 0;
Expand Down
8 changes: 4 additions & 4 deletions elks/arch/i86/drivers/net/el3.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ enum RxFilter {
#define EP_ID_PORT_END 0x200
#define EP_TAG_MAX 0x7 /* must be 2^n - 1 */

static int el3_isa_probe();
static int INITPROC el3_isa_probe();
//static word_t read_eeprom(int, int);
static word_t id_read_eeprom(int);
static size_t el3_write(struct inode *, struct file *, char *, size_t);
Expand Down Expand Up @@ -141,7 +141,7 @@ struct file_operations el3_fops =
el3_release
};

void el3_drv_init(void) {
void INITPROC el3_drv_init(void) {
ioaddr = net_port; // temporary

verbose = (net_flags&ETHF_VERBOSE);
Expand All @@ -156,7 +156,7 @@ void el3_drv_init(void) {

}

static int el3_find_id_port ( void ) {
static int INITPROC el3_find_id_port ( void ) {

for ( el3_id_port = EP_ID_PORT_START ;
el3_id_port < EP_ID_PORT_END ;
Expand All @@ -176,7 +176,7 @@ static int el3_find_id_port ( void ) {
}

/* Return 0 on success, 1 on error */
static int el3_isa_probe( void )
static int INITPROC el3_isa_probe( void )
{
short lrs_state = 0xff;
int i;
Expand Down
6 changes: 3 additions & 3 deletions elks/arch/i86/drivers/net/wd.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static void wd_get_hw_addr(word_t * data)
* determine bus width if possible.
*/

static int wd_probe(void) {
static int INITPROC wd_probe(void) {
int i, tmp = 0;

for (i = 0; i < 8; i++)
Expand Down Expand Up @@ -706,7 +706,7 @@ static void wd_int(int irq, struct pt_regs * regs)
* Ethernet main initialization (during boot)
*/

void wd_drv_init(void)
void INITPROC wd_drv_init(void)
{
unsigned u;
word_t hw_addr[6U];
Expand Down Expand Up @@ -734,7 +734,7 @@ void wd_drv_init(void)
/* Using this wrapper saves 44 bytes of RAM */
/* Using word transfers when possible improves transfer time ~10%
* on large packets (measured @ 1200 bytes) */
void fmemcpy(void *dst_off, seg_t dst_seg, void *src_off, seg_t src_seg, size_t count, int type) {
static void fmemcpy(void *dst_off, seg_t dst_seg, void *src_off, seg_t src_seg, size_t count, int type) {

if (type == is_8bit)
fmemcpyb(dst_off, dst_seg, src_off, src_seg, count);
Expand Down
6 changes: 0 additions & 6 deletions elks/include/linuxmt/cgatext.h

This file was deleted.

24 changes: 12 additions & 12 deletions elks/include/linuxmt/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ extern int INITPROC bioshd_init(void);
extern int INITPROC get_ide_data(int, struct drive_infot *);
extern int directhd_init(void);
extern void floppy_init(void);
extern void rd_init(void);
extern void ssd_init(void);
extern void INITPROC rd_init(void);
extern void INITPROC ssd_init(void);
extern void romflash_init(void);

/* char device init routines*/
extern void chr_dev_init(void);
extern void cgatext_init(void);
extern void eth_init(void);
extern void INITPROC chr_dev_init(void);
extern void INITPROC cgatext_init(void);
extern void INITPROC eth_init(void);
extern void ne2k_drv_init(void);
extern void el3_drv_init(void);
extern void wd_drv_init(void);
extern void lp_init(void);
extern void mem_dev_init(void);
extern void meta_init(void);
extern void pty_init(void);
extern void tcpdev_init(void);
extern void INITPROC el3_drv_init(void);
extern void INITPROC wd_drv_init(void);
extern void INITPROC lp_init(void);
extern void INITPROC mem_dev_init(void);
extern void INITPROC meta_init(void);
extern void INITPROC pty_init(void);
extern void INITPROC tcpdev_init(void);

extern void kfork_proc(void (*addr)());
extern void arch_setup_user_stack(struct task_struct *, word_t entry);
Expand Down

0 comments on commit 07dab55

Please sign in to comment.