Skip to content

Commit

Permalink
samples: mark {static|__init|__exit} for {init|exit} functions
Browse files Browse the repository at this point in the history
None of these (init|exit) functions is called from other functions which
is outside the kernel module mechanism or kernel itself, so mark them as
{static|__init|__exit}.

Signed-off-by: Qinghuang Feng <[email protected]>
Cc: Mathieu Desnoyers <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Qinghuang Feng authored and torvalds committed Jan 6, 2009
1 parent 9fe0608 commit 7ec7fb3
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion samples/firmware_class/firmware_sample_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static void sample_probe_async(void)
" request_firmware_nowait failed\n");
}

static int sample_init(void)
static int __init sample_init(void)
{
device_initialize(&ghost_device);
/* since there is no real hardware insertion I just call the
Expand Down
4 changes: 2 additions & 2 deletions samples/kobject/kobject-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static struct attribute_group attr_group = {

static struct kobject *example_kobj;

static int example_init(void)
static int __init example_init(void)
{
int retval;

Expand All @@ -126,7 +126,7 @@ static int example_init(void)
return retval;
}

static void example_exit(void)
static void __exit example_exit(void)
{
kobject_put(example_kobj);
}
Expand Down
4 changes: 2 additions & 2 deletions samples/kobject/kset-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static void destroy_foo_obj(struct foo_obj *foo)
kobject_put(&foo->kobj);
}

static int example_init(void)
static int __init example_init(void)
{
/*
* Create a kset with the name of "kset_example",
Expand Down Expand Up @@ -264,7 +264,7 @@ static int example_init(void)
return -EINVAL;
}

static void example_exit(void)
static void __exit example_exit(void)
{
destroy_foo_obj(baz_obj);
destroy_foo_obj(bar_obj);
Expand Down
4 changes: 2 additions & 2 deletions samples/markers/marker-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static struct file_operations mark_ops = {
.open = my_open,
};

static int example_init(void)
static int __init example_init(void)
{
printk(KERN_ALERT "example init\n");
pentry_example = proc_create("marker-example", 0444, NULL, &mark_ops);
Expand All @@ -39,7 +39,7 @@ static int example_init(void)
return 0;
}

static void example_exit(void)
static void __exit example_exit(void)
{
printk(KERN_ALERT "example exit\n");
remove_proc_entry("marker-example", NULL);
Expand Down
4 changes: 2 additions & 2 deletions samples/tracepoints/tracepoint-probe-sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static void probe_subsys_eventb(void)
printk(KERN_INFO "Event B is encountered\n");
}

int __init tp_sample_trace_init(void)
static int __init tp_sample_trace_init(void)
{
int ret;

Expand All @@ -42,7 +42,7 @@ int __init tp_sample_trace_init(void)

module_init(tp_sample_trace_init);

void __exit tp_sample_trace_exit(void)
static void __exit tp_sample_trace_exit(void)
{
unregister_trace_subsys_eventb(probe_subsys_eventb);
unregister_trace_subsys_event(probe_subsys_event);
Expand Down
4 changes: 2 additions & 2 deletions samples/tracepoints/tracepoint-probe-sample2.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static void probe_subsys_event(struct inode *inode, struct file *file)
inode->i_ino);
}

int __init tp_sample_trace_init(void)
static int __init tp_sample_trace_init(void)
{
int ret;

Expand All @@ -30,7 +30,7 @@ int __init tp_sample_trace_init(void)

module_init(tp_sample_trace_init);

void __exit tp_sample_trace_exit(void)
static void __exit tp_sample_trace_exit(void)
{
unregister_trace_subsys_event(probe_subsys_event);
tracepoint_synchronize_unregister();
Expand Down
4 changes: 2 additions & 2 deletions samples/tracepoints/tracepoint-sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static struct file_operations mark_ops = {
.open = my_open,
};

static int example_init(void)
static int __init example_init(void)
{
printk(KERN_ALERT "example init\n");
pentry_example = proc_create("tracepoint-example", 0444, NULL,
Expand All @@ -42,7 +42,7 @@ static int example_init(void)
return 0;
}

static void example_exit(void)
static void __exit example_exit(void)
{
printk(KERN_ALERT "example exit\n");
remove_proc_entry("tracepoint-example", NULL);
Expand Down

0 comments on commit 7ec7fb3

Please sign in to comment.