aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/sbp2.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2006-11-02 15:16:08 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2006-12-07 15:46:10 -0500
commitea42ea0f58aaa03e9cd245b124903e25629746e6 (patch)
tree371997fbe26bcef88a9a8cd808a1071905593da1 /drivers/ieee1394/sbp2.c
parent66743e061f6f31ac81fb8a1e9edb2ff92ef24df2 (diff)
ieee1394: sbp2: clean up function declarations
Remove unnecessary function prototypes. Remove variable names from function prototypes. Move declarations from sbp2.h to sbp2.c. Move definitions of driver templates together near the top of sbp2.c. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/ieee1394/sbp2.c')
-rw-r--r--drivers/ieee1394/sbp2.c145
1 files changed, 86 insertions, 59 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index becd98d411ec..f1f5de616d79 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -180,19 +180,6 @@ MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0"
180 ", or a combination)"); 180 ", or a combination)");
181 181
182/* 182/*
183 * Export information about protocols/devices supported by this driver.
184 */
185static struct ieee1394_device_id sbp2_id_table[] = {
186 {
187 .match_flags = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION,
188 .specifier_id = SBP2_UNIT_SPEC_ID_ENTRY & 0xffffff,
189 .version = SBP2_SW_VERSION_ENTRY & 0xffffff},
190 {}
191};
192
193MODULE_DEVICE_TABLE(ieee1394, sbp2_id_table);
194
195/*
196 * Debug levels, configured via kernel config, or enable here. 183 * Debug levels, configured via kernel config, or enable here.
197 */ 184 */
198 185
@@ -250,40 +237,66 @@ static u32 global_outstanding_dmas = 0;
250/* 237/*
251 * Globals 238 * Globals
252 */ 239 */
240static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *, u32);
241static void sbp2scsi_complete_command(struct scsi_id_instance_data *, u32,
242 struct scsi_cmnd *,
243 void (*)(struct scsi_cmnd *));
244static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *);
245static int sbp2_start_device(struct scsi_id_instance_data *);
246static void sbp2_remove_device(struct scsi_id_instance_data *);
247static int sbp2_login_device(struct scsi_id_instance_data *);
248static int sbp2_reconnect_device(struct scsi_id_instance_data *);
249static int sbp2_logout_device(struct scsi_id_instance_data *);
250static void sbp2_host_reset(struct hpsb_host *);
251static int sbp2_handle_status_write(struct hpsb_host *, int, int, quadlet_t *,
252 u64, size_t, u16);
253static int sbp2_agent_reset(struct scsi_id_instance_data *, int);
254static void sbp2_parse_unit_directory(struct scsi_id_instance_data *,
255 struct unit_directory *);
256static int sbp2_set_busy_timeout(struct scsi_id_instance_data *);
257static int sbp2_max_speed_and_size(struct scsi_id_instance_data *);
253 258
254static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id,
255 u32 status);
256
257static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
258 u32 scsi_status, struct scsi_cmnd *SCpnt,
259 void (*done)(struct scsi_cmnd *));
260
261static struct scsi_host_template scsi_driver_template;
262 259
263static const u8 sbp2_speedto_max_payload[] = { 0x7, 0x8, 0x9, 0xA, 0xB, 0xC }; 260static const u8 sbp2_speedto_max_payload[] = { 0x7, 0x8, 0x9, 0xA, 0xB, 0xC };
264 261
265static void sbp2_host_reset(struct hpsb_host *host);
266
267static int sbp2_probe(struct device *dev);
268static int sbp2_remove(struct device *dev);
269static int sbp2_update(struct unit_directory *ud);
270
271static struct hpsb_highlevel sbp2_highlevel = { 262static struct hpsb_highlevel sbp2_highlevel = {
272 .name = SBP2_DEVICE_NAME, 263 .name = SBP2_DEVICE_NAME,
273 .host_reset = sbp2_host_reset, 264 .host_reset = sbp2_host_reset,
274}; 265};
275 266
276static struct hpsb_address_ops sbp2_ops = { 267static struct hpsb_address_ops sbp2_ops = {
277 .write = sbp2_handle_status_write 268 .write = sbp2_handle_status_write
278}; 269};
279 270
280#ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA 271#ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA
272static int sbp2_handle_physdma_write(struct hpsb_host *, int, int, quadlet_t *,
273 u64, size_t, u16);
274static int sbp2_handle_physdma_read(struct hpsb_host *, int, quadlet_t *, u64,
275 size_t, u16);
276
281static struct hpsb_address_ops sbp2_physdma_ops = { 277static struct hpsb_address_ops sbp2_physdma_ops = {
282 .read = sbp2_handle_physdma_read, 278 .read = sbp2_handle_physdma_read,
283 .write = sbp2_handle_physdma_write, 279 .write = sbp2_handle_physdma_write,
284}; 280};
285#endif 281#endif
286 282
283
284/*
285 * Interface to driver core and IEEE 1394 core
286 */
287static struct ieee1394_device_id sbp2_id_table[] = {
288 {
289 .match_flags = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION,
290 .specifier_id = SBP2_UNIT_SPEC_ID_ENTRY & 0xffffff,
291 .version = SBP2_SW_VERSION_ENTRY & 0xffffff},
292 {}
293};
294MODULE_DEVICE_TABLE(ieee1394, sbp2_id_table);
295
296static int sbp2_probe(struct device *);
297static int sbp2_remove(struct device *);
298static int sbp2_update(struct unit_directory *);
299
287static struct hpsb_protocol_driver sbp2_driver = { 300static struct hpsb_protocol_driver sbp2_driver = {
288 .name = "SBP2 Driver", 301 .name = "SBP2 Driver",
289 .id_table = sbp2_id_table, 302 .id_table = sbp2_id_table,
@@ -296,6 +309,47 @@ static struct hpsb_protocol_driver sbp2_driver = {
296 }, 309 },
297}; 310};
298 311
312
313/*
314 * Interface to SCSI core
315 */
316static int sbp2scsi_queuecommand(struct scsi_cmnd *,
317 void (*)(struct scsi_cmnd *));
318static int sbp2scsi_abort(struct scsi_cmnd *);
319static int sbp2scsi_reset(struct scsi_cmnd *);
320static int sbp2scsi_slave_alloc(struct scsi_device *);
321static int sbp2scsi_slave_configure(struct scsi_device *);
322static void sbp2scsi_slave_destroy(struct scsi_device *);
323static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *,
324 struct device_attribute *, char *);
325
326static DEVICE_ATTR(ieee1394_id, S_IRUGO, sbp2_sysfs_ieee1394_id_show, NULL);
327
328static struct device_attribute *sbp2_sysfs_sdev_attrs[] = {
329 &dev_attr_ieee1394_id,
330 NULL
331};
332
333static struct scsi_host_template scsi_driver_template = {
334 .module = THIS_MODULE,
335 .name = "SBP-2 IEEE-1394",
336 .proc_name = SBP2_DEVICE_NAME,
337 .queuecommand = sbp2scsi_queuecommand,
338 .eh_abort_handler = sbp2scsi_abort,
339 .eh_device_reset_handler = sbp2scsi_reset,
340 .slave_alloc = sbp2scsi_slave_alloc,
341 .slave_configure = sbp2scsi_slave_configure,
342 .slave_destroy = sbp2scsi_slave_destroy,
343 .this_id = -1,
344 .sg_tablesize = SG_ALL,
345 .use_clustering = ENABLE_CLUSTERING,
346 .cmd_per_lun = SBP2_MAX_CMDS,
347 .can_queue = SBP2_MAX_CMDS,
348 .emulated = 1,
349 .sdev_attrs = sbp2_sysfs_sdev_attrs,
350};
351
352
299/* 353/*
300 * List of devices with known bugs. 354 * List of devices with known bugs.
301 * 355 *
@@ -715,7 +769,6 @@ static inline int sbp2util_node_is_available(struct scsi_id_instance_data *scsi_
715/********************************************* 769/*********************************************
716 * IEEE-1394 core driver stack related section 770 * IEEE-1394 core driver stack related section
717 *********************************************/ 771 *********************************************/
718static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud);
719 772
720static int sbp2_probe(struct device *dev) 773static int sbp2_probe(struct device *dev)
721{ 774{
@@ -2630,38 +2683,12 @@ static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev,
2630 return sprintf(buf, "%016Lx:%d:%d\n", (unsigned long long)scsi_id->ne->guid, 2683 return sprintf(buf, "%016Lx:%d:%d\n", (unsigned long long)scsi_id->ne->guid,
2631 scsi_id->ud->id, lun); 2684 scsi_id->ud->id, lun);
2632} 2685}
2633static DEVICE_ATTR(ieee1394_id, S_IRUGO, sbp2_sysfs_ieee1394_id_show, NULL);
2634
2635static struct device_attribute *sbp2_sysfs_sdev_attrs[] = {
2636 &dev_attr_ieee1394_id,
2637 NULL
2638};
2639 2686
2640MODULE_AUTHOR("Ben Collins <bcollins@debian.org>"); 2687MODULE_AUTHOR("Ben Collins <bcollins@debian.org>");
2641MODULE_DESCRIPTION("IEEE-1394 SBP-2 protocol driver"); 2688MODULE_DESCRIPTION("IEEE-1394 SBP-2 protocol driver");
2642MODULE_SUPPORTED_DEVICE(SBP2_DEVICE_NAME); 2689MODULE_SUPPORTED_DEVICE(SBP2_DEVICE_NAME);
2643MODULE_LICENSE("GPL"); 2690MODULE_LICENSE("GPL");
2644 2691
2645/* SCSI host template */
2646static struct scsi_host_template scsi_driver_template = {
2647 .module = THIS_MODULE,
2648 .name = "SBP-2 IEEE-1394",
2649 .proc_name = SBP2_DEVICE_NAME,
2650 .queuecommand = sbp2scsi_queuecommand,
2651 .eh_abort_handler = sbp2scsi_abort,
2652 .eh_device_reset_handler = sbp2scsi_reset,
2653 .slave_alloc = sbp2scsi_slave_alloc,
2654 .slave_configure = sbp2scsi_slave_configure,
2655 .slave_destroy = sbp2scsi_slave_destroy,
2656 .this_id = -1,
2657 .sg_tablesize = SG_ALL,
2658 .use_clustering = ENABLE_CLUSTERING,
2659 .cmd_per_lun = SBP2_MAX_CMDS,
2660 .can_queue = SBP2_MAX_CMDS,
2661 .emulated = 1,
2662 .sdev_attrs = sbp2_sysfs_sdev_attrs,
2663};
2664
2665static int sbp2_module_init(void) 2692static int sbp2_module_init(void)
2666{ 2693{
2667 int ret; 2694 int ret;