aboutsummaryrefslogtreecommitdiffstats
path: root/samples/firmware_class/firmware_sample_driver.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-02-20 19:07:07 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-19 22:10:21 -0400
commit4b65fc8cfbd1d1cfcc78865af72608e3b6cc9d9b (patch)
tree051bf779c3ad7b09960459b3d26c9408124f5ef3 /samples/firmware_class/firmware_sample_driver.c
parentd289bf7bdd84d636054acb0b3d14a4708f8a8233 (diff)
firmware: clean up samples for coding style issues
This fixes up a number of coding style issues in the firmware sample files. Yeah, it still doesn't build properly yet, that's next... Cc: Randy Dunlap <randy.dunlap@oracle.com> Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'samples/firmware_class/firmware_sample_driver.c')
-rw-r--r--samples/firmware_class/firmware_sample_driver.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/samples/firmware_class/firmware_sample_driver.c b/samples/firmware_class/firmware_sample_driver.c
index ff0f2f2bd1a8..165cff98032e 100644
--- a/samples/firmware_class/firmware_sample_driver.c
+++ b/samples/firmware_class/firmware_sample_driver.c
@@ -12,8 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/string.h> 14#include <linux/string.h>
15 15#include <linux/firmware.h>
16#include "linux/firmware.h"
17 16
18static struct device ghost_device = { 17static struct device ghost_device = {
19 .bus_id = "ghost0", 18 .bus_id = "ghost0",
@@ -31,11 +30,14 @@ static void sample_firmware_load(char *firmware, int size)
31static void sample_probe_default(void) 30static void sample_probe_default(void)
32{ 31{
33 /* uses the default method to get the firmware */ 32 /* uses the default method to get the firmware */
34 const struct firmware *fw_entry; 33 const struct firmware *fw_entry;
35 printk(KERN_INFO "firmware_sample_driver: a ghost device got inserted :)\n"); 34 int retval;
35
36 printk(KERN_INFO "firmware_sample_driver: "
37 "a ghost device got inserted :)\n");
36 38
37 if(request_firmware(&fw_entry, "sample_driver_fw", &ghost_device)!=0) 39 retval = request_firmware(&fw_entry, "sample_driver_fw", &ghost_device);
38 { 40 if (retval) {
39 printk(KERN_ERR 41 printk(KERN_ERR
40 "firmware_sample_driver: Firmware not available\n"); 42 "firmware_sample_driver: Firmware not available\n");
41 return; 43 return;
@@ -47,17 +49,20 @@ static void sample_probe_default(void)
47 49
48 /* finish setting up the device */ 50 /* finish setting up the device */
49} 51}
52
50static void sample_probe_specific(void) 53static void sample_probe_specific(void)
51{ 54{
55 int retval;
52 /* Uses some specific hotplug support to get the firmware from 56 /* Uses some specific hotplug support to get the firmware from
53 * userspace directly into the hardware, or via some sysfs file */ 57 * userspace directly into the hardware, or via some sysfs file */
54 58
55 /* NOTE: This currently doesn't work */ 59 /* NOTE: This currently doesn't work */
56 60
57 printk(KERN_INFO "firmware_sample_driver: a ghost device got inserted :)\n"); 61 printk(KERN_INFO "firmware_sample_driver: "
62 "a ghost device got inserted :)\n");
58 63
59 if(request_firmware(NULL, "sample_driver_fw", &ghost_device)!=0) 64 retval = request_firmware(NULL, "sample_driver_fw", &ghost_device);
60 { 65 if (retval) {
61 printk(KERN_ERR 66 printk(KERN_ERR
62 "firmware_sample_driver: Firmware load failed\n"); 67 "firmware_sample_driver: Firmware load failed\n");
63 return; 68 return;
@@ -70,7 +75,7 @@ static void sample_probe_specific(void)
70} 75}
71static void sample_probe_async_cont(const struct firmware *fw, void *context) 76static void sample_probe_async_cont(const struct firmware *fw, void *context)
72{ 77{
73 if(!fw){ 78 if (!fw) {
74 printk(KERN_ERR 79 printk(KERN_ERR
75 "firmware_sample_driver: firmware load failed\n"); 80 "firmware_sample_driver: firmware load failed\n");
76 return; 81 return;
@@ -80,19 +85,18 @@ static void sample_probe_async_cont(const struct firmware *fw, void *context)
80 (char *)context); 85 (char *)context);
81 sample_firmware_load(fw->data, fw->size); 86 sample_firmware_load(fw->data, fw->size);
82} 87}
88
83static void sample_probe_async(void) 89static void sample_probe_async(void)
84{ 90{
85 /* Let's say that I can't sleep */ 91 /* Let's say that I can't sleep */
86 int error; 92 int error;
87 error = request_firmware_nowait (THIS_MODULE, FW_ACTION_NOHOTPLUG, 93 error = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG,
88 "sample_driver_fw", &ghost_device, 94 "sample_driver_fw", &ghost_device,
89 "my device pointer", 95 "my device pointer",
90 sample_probe_async_cont); 96 sample_probe_async_cont);
91 if(error){ 97 if (error)
92 printk(KERN_ERR 98 printk(KERN_ERR "firmware_sample_driver:"
93 "firmware_sample_driver:"
94 " request_firmware_nowait failed\n"); 99 " request_firmware_nowait failed\n");
95 }
96} 100}
97 101
98static int sample_init(void) 102static int sample_init(void)
@@ -105,11 +109,12 @@ static int sample_init(void)
105 sample_probe_async(); 109 sample_probe_async();
106 return 0; 110 return 0;
107} 111}
112
108static void __exit sample_exit(void) 113static void __exit sample_exit(void)
109{ 114{
110} 115}
111 116
112module_init (sample_init); 117module_init(sample_init);
113module_exit (sample_exit); 118module_exit(sample_exit);
114 119
115MODULE_LICENSE("GPL"); 120MODULE_LICENSE("GPL");