diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2010-02-04 09:42:24 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-02-17 14:19:25 -0500 |
commit | a104c99f386191706a11d39be81b8f03cd4f2719 (patch) | |
tree | 9a8a0cd868ac23eeaf45a3a1a4bf44c31cae9f72 /drivers | |
parent | 6df1e95496f8dfe08a520756187be59f7896f589 (diff) |
[SCSI] hpsa: make tag macros into functions
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/hpsa.c | 26 | ||||
-rw-r--r-- | drivers/scsi/hpsa.h | 3 |
2 files changed, 22 insertions, 7 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index ba3deaddf150..82987e1850a1 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -2723,6 +2723,24 @@ static inline void finish_cmd(struct CommandList *c, u32 raw_tag) | |||
2723 | complete(c->waiting); | 2723 | complete(c->waiting); |
2724 | } | 2724 | } |
2725 | 2725 | ||
2726 | static inline u32 hpsa_tag_contains_index(u32 tag) | ||
2727 | { | ||
2728 | #define DIRECT_LOOKUP_BIT 0x04 | ||
2729 | return tag & DIRECT_LOOKUP_BIT; | ||
2730 | } | ||
2731 | |||
2732 | static inline u32 hpsa_tag_to_index(u32 tag) | ||
2733 | { | ||
2734 | #define DIRECT_LOOKUP_SHIFT 3 | ||
2735 | return tag >> DIRECT_LOOKUP_SHIFT; | ||
2736 | } | ||
2737 | |||
2738 | static inline u32 hpsa_tag_discard_error_bits(u32 tag) | ||
2739 | { | ||
2740 | #define HPSA_ERROR_BITS 0x03 | ||
2741 | return tag & ~HPSA_ERROR_BITS; | ||
2742 | } | ||
2743 | |||
2726 | static irqreturn_t do_hpsa_intr(int irq, void *dev_id) | 2744 | static irqreturn_t do_hpsa_intr(int irq, void *dev_id) |
2727 | { | 2745 | { |
2728 | struct ctlr_info *h = dev_id; | 2746 | struct ctlr_info *h = dev_id; |
@@ -2736,15 +2754,15 @@ static irqreturn_t do_hpsa_intr(int irq, void *dev_id) | |||
2736 | spin_lock_irqsave(&h->lock, flags); | 2754 | spin_lock_irqsave(&h->lock, flags); |
2737 | while (interrupt_pending(h)) { | 2755 | while (interrupt_pending(h)) { |
2738 | while ((raw_tag = get_next_completion(h)) != FIFO_EMPTY) { | 2756 | while ((raw_tag = get_next_completion(h)) != FIFO_EMPTY) { |
2739 | if (likely(HPSA_TAG_CONTAINS_INDEX(raw_tag))) { | 2757 | if (likely(hpsa_tag_contains_index(raw_tag))) { |
2740 | tag_index = HPSA_TAG_TO_INDEX(raw_tag); | 2758 | tag_index = hpsa_tag_to_index(raw_tag); |
2741 | if (bad_tag(h, tag_index, raw_tag)) | 2759 | if (bad_tag(h, tag_index, raw_tag)) |
2742 | return IRQ_HANDLED; | 2760 | return IRQ_HANDLED; |
2743 | c = h->cmd_pool + tag_index; | 2761 | c = h->cmd_pool + tag_index; |
2744 | finish_cmd(c, raw_tag); | 2762 | finish_cmd(c, raw_tag); |
2745 | continue; | 2763 | continue; |
2746 | } | 2764 | } |
2747 | tag = HPSA_TAG_DISCARD_ERROR_BITS(raw_tag); | 2765 | tag = hpsa_tag_discard_error_bits(raw_tag); |
2748 | c = NULL; | 2766 | c = NULL; |
2749 | hlist_for_each_entry(c, tmp, &h->cmpQ, list) { | 2767 | hlist_for_each_entry(c, tmp, &h->cmpQ, list) { |
2750 | if (c->busaddr == tag) { | 2768 | if (c->busaddr == tag) { |
@@ -2824,7 +2842,7 @@ static __devinit int hpsa_message(struct pci_dev *pdev, unsigned char opcode, | |||
2824 | 2842 | ||
2825 | for (i = 0; i < HPSA_MSG_SEND_RETRY_LIMIT; i++) { | 2843 | for (i = 0; i < HPSA_MSG_SEND_RETRY_LIMIT; i++) { |
2826 | tag = readl(vaddr + SA5_REPLY_PORT_OFFSET); | 2844 | tag = readl(vaddr + SA5_REPLY_PORT_OFFSET); |
2827 | if (HPSA_TAG_DISCARD_ERROR_BITS(tag) == paddr32) | 2845 | if (hpsa_tag_discard_error_bits(tag) == paddr32) |
2828 | break; | 2846 | break; |
2829 | msleep(HPSA_MSG_SEND_RETRY_INTERVAL_MSECS); | 2847 | msleep(HPSA_MSG_SEND_RETRY_INTERVAL_MSECS); |
2830 | } | 2848 | } |
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h index 194968e861c7..da8dd3e619cb 100644 --- a/drivers/scsi/hpsa.h +++ b/drivers/scsi/hpsa.h | |||
@@ -164,9 +164,6 @@ struct ctlr_info { | |||
164 | #define HPSA_FIRMWARE_READY 0xffff0000 /* value in scratchpad register */ | 164 | #define HPSA_FIRMWARE_READY 0xffff0000 /* value in scratchpad register */ |
165 | 165 | ||
166 | #define HPSA_ERROR_BIT 0x02 | 166 | #define HPSA_ERROR_BIT 0x02 |
167 | #define HPSA_TAG_CONTAINS_INDEX(tag) ((tag) & 0x04) | ||
168 | #define HPSA_TAG_TO_INDEX(tag) ((tag) >> 3) | ||
169 | #define HPSA_TAG_DISCARD_ERROR_BITS(tag) ((tag) & ~3) | ||
170 | 167 | ||
171 | #define HPSA_INTR_ON 1 | 168 | #define HPSA_INTR_ON 1 |
172 | #define HPSA_INTR_OFF 0 | 169 | #define HPSA_INTR_OFF 0 |