diff options
author | Markus Lidel <Markus.Lidel@shadowconnect.com> | 2005-06-24 01:02:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:05:28 -0400 |
commit | f88e119c4b824a5017456fa094950d0f4092d96c (patch) | |
tree | 7a0fea02c195732e299a576fd22fd439fbc38bdd /include/linux/i2o.h | |
parent | 61fbfa8129c1771061a0e9f47747854293081c5b (diff) |
[PATCH] I2O: first code cleanup of spare warnings and unused functions
Changes:
- Removed unnecessary checking of NULL before calling kfree()
- Make some functions static
- Changed pr_debug() into osm_debug()
- Use i2o_msg_in_to_virt() for getting a pointer to the message frame
- Cleaned up some comments
- Changed some le32_to_cpu() into readl() where necessary
- Make error messages of OSM's look the same
- Cleaned up error handling in i2o_block_end_request()
- Removed unused error handling of failed messages in Block-OSM, which
are not allowed by the I2O spec
- Corrected the blocksize detection in i2o_block
- Added hrt and lct sysfs-attribute to controller
- Call done() function in SCSI-OSM after freeing DMA buffers
- Removed unneeded variable for message size calculation in
i2o_scsi_queuecommand()
- Make some changes to remove sparse warnings
- Reordered some functions
- Cleaned up controller initialization
- Replaced some magic numbers by defines
- Removed unnecessary dma_sync_single_for_cpu() call on coherent DMA
- Removed some unused fields in i2o_controller and removed some unused
functions
Signed-off-by: Markus Lidel <Markus.Lidel@shadowconnect.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/i2o.h')
-rw-r--r-- | include/linux/i2o.h | 74 |
1 files changed, 16 insertions, 58 deletions
diff --git a/include/linux/i2o.h b/include/linux/i2o.h index 40e45a83d3fb..e8cd11290010 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h | |||
@@ -153,12 +153,10 @@ struct i2o_controller { | |||
153 | unsigned int promise:1; /* Promise controller */ | 153 | unsigned int promise:1; /* Promise controller */ |
154 | 154 | ||
155 | struct list_head devices; /* list of I2O devices */ | 155 | struct list_head devices; /* list of I2O devices */ |
156 | |||
157 | struct notifier_block *event_notifer; /* Events */ | ||
158 | atomic_t users; | ||
159 | struct list_head list; /* Controller list */ | 156 | struct list_head list; /* Controller list */ |
160 | void __iomem *post_port; /* Inbout port address */ | 157 | |
161 | void __iomem *reply_port; /* Outbound port address */ | 158 | void __iomem *in_port; /* Inbout port address */ |
159 | void __iomem *out_port; /* Outbound port address */ | ||
162 | void __iomem *irq_mask; /* Interrupt register address */ | 160 | void __iomem *irq_mask; /* Interrupt register address */ |
163 | 161 | ||
164 | /* Dynamic LCT related data */ | 162 | /* Dynamic LCT related data */ |
@@ -182,9 +180,6 @@ struct i2o_controller { | |||
182 | struct resource io_resource; /* I/O resource allocated to the IOP */ | 180 | struct resource io_resource; /* I/O resource allocated to the IOP */ |
183 | struct resource mem_resource; /* Mem resource allocated to the IOP */ | 181 | struct resource mem_resource; /* Mem resource allocated to the IOP */ |
184 | 182 | ||
185 | struct proc_dir_entry *proc_entry; /* /proc dir */ | ||
186 | |||
187 | struct list_head bus_list; /* list of busses on IOP */ | ||
188 | struct device device; | 183 | struct device device; |
189 | struct i2o_device *exec; /* Executive */ | 184 | struct i2o_device *exec; /* Executive */ |
190 | #if BITS_PER_LONG == 64 | 185 | #if BITS_PER_LONG == 64 |
@@ -380,49 +375,10 @@ extern int i2o_device_claim_release(struct i2o_device *); | |||
380 | /* Exec OSM functions */ | 375 | /* Exec OSM functions */ |
381 | extern int i2o_exec_lct_get(struct i2o_controller *); | 376 | extern int i2o_exec_lct_get(struct i2o_controller *); |
382 | 377 | ||
383 | /* device to i2o_device and driver to i2o_driver convertion functions */ | 378 | /* device / driver conversion functions */ |
384 | #define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver) | 379 | #define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver) |
385 | #define to_i2o_device(dev) container_of(dev, struct i2o_device, device) | 380 | #define to_i2o_device(dev) container_of(dev, struct i2o_device, device) |
386 | 381 | #define to_i2o_controller(dev) container_of(dev, struct i2o_controller, device) | |
387 | /* | ||
388 | * Messenger inlines | ||
389 | */ | ||
390 | static inline u32 I2O_POST_READ32(struct i2o_controller *c) | ||
391 | { | ||
392 | rmb(); | ||
393 | return readl(c->post_port); | ||
394 | }; | ||
395 | |||
396 | static inline void I2O_POST_WRITE32(struct i2o_controller *c, u32 val) | ||
397 | { | ||
398 | wmb(); | ||
399 | writel(val, c->post_port); | ||
400 | }; | ||
401 | |||
402 | static inline u32 I2O_REPLY_READ32(struct i2o_controller *c) | ||
403 | { | ||
404 | rmb(); | ||
405 | return readl(c->reply_port); | ||
406 | }; | ||
407 | |||
408 | static inline void I2O_REPLY_WRITE32(struct i2o_controller *c, u32 val) | ||
409 | { | ||
410 | wmb(); | ||
411 | writel(val, c->reply_port); | ||
412 | }; | ||
413 | |||
414 | static inline u32 I2O_IRQ_READ32(struct i2o_controller *c) | ||
415 | { | ||
416 | rmb(); | ||
417 | return readl(c->irq_mask); | ||
418 | }; | ||
419 | |||
420 | static inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 val) | ||
421 | { | ||
422 | wmb(); | ||
423 | writel(val, c->irq_mask); | ||
424 | wmb(); | ||
425 | }; | ||
426 | 382 | ||
427 | /** | 383 | /** |
428 | * i2o_msg_get - obtain an I2O message from the IOP | 384 | * i2o_msg_get - obtain an I2O message from the IOP |
@@ -440,10 +396,12 @@ static inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 val) | |||
440 | static inline u32 i2o_msg_get(struct i2o_controller *c, | 396 | static inline u32 i2o_msg_get(struct i2o_controller *c, |
441 | struct i2o_message __iomem **msg) | 397 | struct i2o_message __iomem **msg) |
442 | { | 398 | { |
443 | u32 m; | 399 | u32 m = readl(c->in_port); |
444 | 400 | ||
445 | if ((m = I2O_POST_READ32(c)) != I2O_QUEUE_EMPTY) | 401 | if (m != I2O_QUEUE_EMPTY) { |
446 | *msg = c->in_queue.virt + m; | 402 | *msg = c->in_queue.virt + m; |
403 | rmb(); | ||
404 | } | ||
447 | 405 | ||
448 | return m; | 406 | return m; |
449 | }; | 407 | }; |
@@ -457,7 +415,8 @@ static inline u32 i2o_msg_get(struct i2o_controller *c, | |||
457 | */ | 415 | */ |
458 | static inline void i2o_msg_post(struct i2o_controller *c, u32 m) | 416 | static inline void i2o_msg_post(struct i2o_controller *c, u32 m) |
459 | { | 417 | { |
460 | I2O_POST_WRITE32(c, m); | 418 | wmb(); |
419 | writel(m, c->in_port); | ||
461 | }; | 420 | }; |
462 | 421 | ||
463 | /** | 422 | /** |
@@ -486,12 +445,10 @@ static inline int i2o_msg_post_wait(struct i2o_controller *c, u32 m, | |||
486 | * The I2O controller must be informed that the reply message is not needed | 445 | * The I2O controller must be informed that the reply message is not needed |
487 | * anymore. If you forget to flush the reply, the message frame can't be | 446 | * anymore. If you forget to flush the reply, the message frame can't be |
488 | * used by the controller anymore and is therefore lost. | 447 | * used by the controller anymore and is therefore lost. |
489 | * | ||
490 | * FIXME: is there a timeout after which the controller reuse the message? | ||
491 | */ | 448 | */ |
492 | static inline void i2o_flush_reply(struct i2o_controller *c, u32 m) | 449 | static inline void i2o_flush_reply(struct i2o_controller *c, u32 m) |
493 | { | 450 | { |
494 | I2O_REPLY_WRITE32(c, m); | 451 | writel(m, c->out_port); |
495 | }; | 452 | }; |
496 | 453 | ||
497 | /** | 454 | /** |
@@ -505,8 +462,9 @@ static inline void i2o_flush_reply(struct i2o_controller *c, u32 m) | |||
505 | * work for sender side messages as they are ioremap objects | 462 | * work for sender side messages as they are ioremap objects |
506 | * provided by the I2O controller. | 463 | * provided by the I2O controller. |
507 | */ | 464 | */ |
508 | static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c, | 465 | static inline struct i2o_message __iomem *i2o_msg_out_to_virt(struct |
509 | u32 m) | 466 | i2o_controller *c, |
467 | u32 m) | ||
510 | { | 468 | { |
511 | BUG_ON(m < c->out_queue.phys | 469 | BUG_ON(m < c->out_queue.phys |
512 | || m >= c->out_queue.phys + c->out_queue.len); | 470 | || m >= c->out_queue.phys + c->out_queue.len); |
@@ -917,7 +875,7 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
917 | #define I2OVER15 0x0001 | 875 | #define I2OVER15 0x0001 |
918 | #define I2OVER20 0x0002 | 876 | #define I2OVER20 0x0002 |
919 | 877 | ||
920 | /* Default is 1.5, FIXME: Need support for both 1.5 and 2.0 */ | 878 | /* Default is 1.5 */ |
921 | #define I2OVERSION I2OVER15 | 879 | #define I2OVERSION I2OVER15 |
922 | 880 | ||
923 | #define SGL_OFFSET_0 I2OVERSION | 881 | #define SGL_OFFSET_0 I2OVERSION |