Commit c486d30d authored by Ben Collins's avatar Ben Collins

IEEE1394(r1130): Conversion of some list_for_each() usages to list_for_each_entry().

parent 26abb0a1
...@@ -862,14 +862,14 @@ static int stream_alloc_packet_lists(struct stream *s) ...@@ -862,14 +862,14 @@ static int stream_alloc_packet_lists(struct stream *s)
static void stream_free_packet_lists(struct stream *s) static void stream_free_packet_lists(struct stream *s)
{ {
struct list_head *lh, *next; struct packet_list *packet_l, *packet_l_next;
if (s->current_packet_list != NULL) if (s->current_packet_list != NULL)
packet_list_free(s->current_packet_list, s); packet_list_free(s->current_packet_list, s);
list_for_each_safe(lh, next, &s->dma_packet_lists) list_for_each_entry_safe(packet_l, packet_l_next, &s->dma_packet_lists, link)
packet_list_free(list_entry(lh, struct packet_list, link), s); packet_list_free(packet_l, s);
list_for_each_safe(lh, next, &s->free_packet_lists) list_for_each_entry_safe(packet_l, packet_l_next, &s->free_packet_lists, link)
packet_list_free(list_entry(lh, struct packet_list, link), s); packet_list_free(packet_l, s);
if (s->packet_pool != NULL) if (s->packet_pool != NULL)
pci_pool_destroy(s->packet_pool); pci_pool_destroy(s->packet_pool);
......
...@@ -1801,15 +1801,12 @@ static int dv1394_open(struct inode *inode, struct file *file) ...@@ -1801,15 +1801,12 @@ static int dv1394_open(struct inode *inode, struct file *file)
} else { } else {
/* look up the card by ID */ /* look up the card by ID */
struct list_head *lh;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&dv1394_cards_lock, flags); spin_lock_irqsave(&dv1394_cards_lock, flags);
if (!list_empty(&dv1394_cards)) { if (!list_empty(&dv1394_cards)) {
struct video_card *p; struct video_card *p;
list_for_each(lh, &dv1394_cards) { list_for_each_entry(p, &dv1394_cards, list) {
p = list_entry(lh, struct video_card, list);
if ((p->id) == ieee1394_file_to_instance(file)) { if ((p->id) == ieee1394_file_to_instance(file)) {
video = p; video = p;
break; break;
...@@ -2374,7 +2371,6 @@ static void dv1394_host_reset(struct hpsb_host *host) ...@@ -2374,7 +2371,6 @@ static void dv1394_host_reset(struct hpsb_host *host)
struct ti_ohci *ohci; struct ti_ohci *ohci;
struct video_card *video = NULL; struct video_card *video = NULL;
unsigned long flags; unsigned long flags;
struct list_head *lh;
/* We only work with the OHCI-1394 driver */ /* We only work with the OHCI-1394 driver */
if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME)) if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME))
...@@ -2386,8 +2382,7 @@ static void dv1394_host_reset(struct hpsb_host *host) ...@@ -2386,8 +2382,7 @@ static void dv1394_host_reset(struct hpsb_host *host)
/* find the corresponding video_cards */ /* find the corresponding video_cards */
spin_lock_irqsave(&dv1394_cards_lock, flags); spin_lock_irqsave(&dv1394_cards_lock, flags);
if (!list_empty(&dv1394_cards)) { if (!list_empty(&dv1394_cards)) {
list_for_each(lh, &dv1394_cards) { list_for_each_entry(video, &dv1394_cards, list) {
video = list_entry(lh, struct video_card, list);
if ((video->id >> 2) == ohci->id) if ((video->id >> 2) == ohci->id)
break; break;
} }
......
...@@ -946,12 +946,9 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb, ...@@ -946,12 +946,9 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb,
static inline int fragment_overlap(struct list_head *frag_list, int offset, int len) static inline int fragment_overlap(struct list_head *frag_list, int offset, int len)
{ {
struct list_head *lh;
struct fragment_info *fi; struct fragment_info *fi;
list_for_each(lh, frag_list) { list_for_each_entry(fi, frag_list, list) {
fi = list_entry(lh, struct fragment_info, list);
if ( ! ((offset > (fi->offset + fi->len - 1)) || if ( ! ((offset > (fi->offset + fi->len - 1)) ||
((offset + len - 1) < fi->offset))) ((offset + len - 1) < fi->offset)))
return 1; return 1;
...@@ -961,13 +958,11 @@ static inline int fragment_overlap(struct list_head *frag_list, int offset, int ...@@ -961,13 +958,11 @@ static inline int fragment_overlap(struct list_head *frag_list, int offset, int
static inline struct list_head *find_partial_datagram(struct list_head *pdgl, int dgl) static inline struct list_head *find_partial_datagram(struct list_head *pdgl, int dgl)
{ {
struct list_head *lh;
struct partial_datagram *pd; struct partial_datagram *pd;
list_for_each(lh, pdgl) { list_for_each_entry(pd, pdgl, list) {
pd = list_entry(lh, struct partial_datagram, list);
if (pd->dgl == dgl) if (pd->dgl == dgl)
return lh; return &pd->list;
} }
return NULL; return NULL;
} }
......
...@@ -56,14 +56,12 @@ static struct hl_host_info *hl_get_hostinfo(struct hpsb_highlevel *hl, ...@@ -56,14 +56,12 @@ static struct hl_host_info *hl_get_hostinfo(struct hpsb_highlevel *hl,
struct hpsb_host *host) struct hpsb_host *host)
{ {
struct hl_host_info *hi = NULL; struct hl_host_info *hi = NULL;
struct list_head *lh;
if (!hl || !host) if (!hl || !host)
return NULL; return NULL;
read_lock(&hl->host_info_lock); read_lock(&hl->host_info_lock);
list_for_each (lh, &hl->host_info_list) { list_for_each_entry(hi, &hl->host_info_list, list) {
hi = list_entry(lh, struct hl_host_info, list);
if (hi->host == host) if (hi->host == host)
break; break;
hi = NULL; hi = NULL;
...@@ -188,7 +186,6 @@ unsigned long hpsb_get_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host ...@@ -188,7 +186,6 @@ unsigned long hpsb_get_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host
void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key) void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key)
{ {
struct list_head *lh;
struct hl_host_info *hi; struct hl_host_info *hi;
void *data = NULL; void *data = NULL;
...@@ -196,8 +193,7 @@ void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key) ...@@ -196,8 +193,7 @@ void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key)
return NULL; return NULL;
read_lock(&hl->host_info_lock); read_lock(&hl->host_info_lock);
list_for_each (lh, &hl->host_info_list) { list_for_each_entry(hi, &hl->host_info_list, list) {
hi = list_entry(lh, struct hl_host_info, list);
if (hi->key == key) { if (hi->key == key) {
data = hi->data; data = hi->data;
break; break;
...@@ -211,7 +207,6 @@ void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key) ...@@ -211,7 +207,6 @@ void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key)
struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, unsigned long key) struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, unsigned long key)
{ {
struct list_head *lh;
struct hl_host_info *hi; struct hl_host_info *hi;
struct hpsb_host *host = NULL; struct hpsb_host *host = NULL;
...@@ -219,8 +214,7 @@ struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, unsigned long k ...@@ -219,8 +214,7 @@ struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, unsigned long k
return NULL; return NULL;
read_lock(&hl->host_info_lock); read_lock(&hl->host_info_lock);
list_for_each (lh, &hl->host_info_list) { list_for_each_entry(hi, &hl->host_info_list, list) {
hi = list_entry(lh, struct hl_host_info, list);
if (hi->key == key) { if (hi->key == key) {
host = hi->host; host = hi->host;
break; break;
......
...@@ -935,8 +935,7 @@ void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size, ...@@ -935,8 +935,7 @@ void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size,
void abort_requests(struct hpsb_host *host) void abort_requests(struct hpsb_host *host)
{ {
unsigned long flags; unsigned long flags;
struct hpsb_packet *packet; struct hpsb_packet *packet, *packet_next;
struct list_head *lh, *tlh;
LIST_HEAD(llist); LIST_HEAD(llist);
host->driver->devctl(host, CANCEL_REQUESTS, 0); host->driver->devctl(host, CANCEL_REQUESTS, 0);
...@@ -946,8 +945,7 @@ void abort_requests(struct hpsb_host *host) ...@@ -946,8 +945,7 @@ void abort_requests(struct hpsb_host *host)
INIT_LIST_HEAD(&host->pending_packets); INIT_LIST_HEAD(&host->pending_packets);
spin_unlock_irqrestore(&host->pending_pkt_lock, flags); spin_unlock_irqrestore(&host->pending_pkt_lock, flags);
list_for_each_safe(lh, tlh, &llist) { list_for_each_entry_safe(packet, packet_next, &llist, list) {
packet = list_entry(lh, struct hpsb_packet, list);
list_del(&packet->list); list_del(&packet->list);
packet->state = hpsb_complete; packet->state = hpsb_complete;
packet->ack_code = ACKX_ABORTED; packet->ack_code = ACKX_ABORTED;
...@@ -959,9 +957,8 @@ void abort_timedouts(unsigned long __opaque) ...@@ -959,9 +957,8 @@ void abort_timedouts(unsigned long __opaque)
{ {
struct hpsb_host *host = (struct hpsb_host *)__opaque; struct hpsb_host *host = (struct hpsb_host *)__opaque;
unsigned long flags; unsigned long flags;
struct hpsb_packet *packet; struct hpsb_packet *packet, *packet_next;
unsigned long expire; unsigned long expire;
struct list_head *lh, *tlh;
LIST_HEAD(expiredlist); LIST_HEAD(expiredlist);
spin_lock_irqsave(&host->csr.lock, flags); spin_lock_irqsave(&host->csr.lock, flags);
...@@ -970,8 +967,7 @@ void abort_timedouts(unsigned long __opaque) ...@@ -970,8 +967,7 @@ void abort_timedouts(unsigned long __opaque)
spin_lock_irqsave(&host->pending_pkt_lock, flags); spin_lock_irqsave(&host->pending_pkt_lock, flags);
list_for_each_safe(lh, tlh, &host->pending_packets) { list_for_each_entry_safe(packet, packet_next, &host->pending_packets, list) {
packet = list_entry(lh, struct hpsb_packet, list);
if (time_before(packet->sendtime + expire, jiffies)) { if (time_before(packet->sendtime + expire, jiffies)) {
list_del(&packet->list); list_del(&packet->list);
list_add(&packet->list, &expiredlist); list_add(&packet->list, &expiredlist);
...@@ -983,8 +979,7 @@ void abort_timedouts(unsigned long __opaque) ...@@ -983,8 +979,7 @@ void abort_timedouts(unsigned long __opaque)
spin_unlock_irqrestore(&host->pending_pkt_lock, flags); spin_unlock_irqrestore(&host->pending_pkt_lock, flags);
list_for_each_safe(lh, tlh, &expiredlist) { list_for_each_entry_safe(packet, packet_next, &expiredlist, list) {
packet = list_entry(lh, struct hpsb_packet, list);
list_del(&packet->list); list_del(&packet->list);
packet->state = hpsb_complete; packet->state = hpsb_complete;
packet->ack_code = ACKX_TIMEOUT; packet->ack_code = ACKX_TIMEOUT;
......
...@@ -2207,14 +2207,12 @@ static void ohci_schedule_iso_tasklets(struct ti_ohci *ohci, ...@@ -2207,14 +2207,12 @@ static void ohci_schedule_iso_tasklets(struct ti_ohci *ohci,
quadlet_t rx_event, quadlet_t rx_event,
quadlet_t tx_event) quadlet_t tx_event)
{ {
struct list_head *lh;
struct ohci1394_iso_tasklet *t; struct ohci1394_iso_tasklet *t;
unsigned long mask; unsigned long mask;
spin_lock(&ohci->iso_tasklet_list_lock); spin_lock(&ohci->iso_tasklet_list_lock);
list_for_each(lh, &ohci->iso_tasklet_list) { list_for_each_entry(t, &ohci->iso_tasklet_list, link) {
t = list_entry(lh, struct ohci1394_iso_tasklet, link);
mask = 1 << t->context; mask = 1 << t->context;
if (t->type == OHCI_ISO_TRANSMIT && tx_event & mask) if (t->type == OHCI_ISO_TRANSMIT && tx_event & mask)
......
...@@ -215,15 +215,11 @@ static void add_host(struct hpsb_host *host) ...@@ -215,15 +215,11 @@ static void add_host(struct hpsb_host *host)
static struct host_info *find_host_info(struct hpsb_host *host) static struct host_info *find_host_info(struct hpsb_host *host)
{ {
struct list_head *lh;
struct host_info *hi; struct host_info *hi;
list_for_each(lh, &host_info_list) { list_for_each_entry(hi, &host_info_list, list)
hi = list_entry(lh, struct host_info, list); if (hi->host == host)
if (hi->host == host) {
return hi; return hi;
}
}
return NULL; return NULL;
} }
...@@ -262,7 +258,6 @@ static void remove_host(struct hpsb_host *host) ...@@ -262,7 +258,6 @@ static void remove_host(struct hpsb_host *host)
static void host_reset(struct hpsb_host *host) static void host_reset(struct hpsb_host *host)
{ {
unsigned long flags; unsigned long flags;
struct list_head *lh;
struct host_info *hi; struct host_info *hi;
struct file_info *fi; struct file_info *fi;
struct pending_request *req; struct pending_request *req;
...@@ -271,8 +266,7 @@ static void host_reset(struct hpsb_host *host) ...@@ -271,8 +266,7 @@ static void host_reset(struct hpsb_host *host)
hi = find_host_info(host); hi = find_host_info(host);
if (hi != NULL) { if (hi != NULL) {
list_for_each(lh, &hi->file_info_list) { list_for_each_entry(fi, &hi->file_info_list, list) {
fi = list_entry(lh, struct file_info, list);
if (fi->notification == RAW1394_NOTIFY_ON) { if (fi->notification == RAW1394_NOTIFY_ON) {
req = __alloc_pending_request(SLAB_ATOMIC); req = __alloc_pending_request(SLAB_ATOMIC);
...@@ -299,7 +293,6 @@ static void iso_receive(struct hpsb_host *host, int channel, quadlet_t *data, ...@@ -299,7 +293,6 @@ static void iso_receive(struct hpsb_host *host, int channel, quadlet_t *data,
size_t length) size_t length)
{ {
unsigned long flags; unsigned long flags;
struct list_head *lh;
struct host_info *hi; struct host_info *hi;
struct file_info *fi; struct file_info *fi;
struct pending_request *req; struct pending_request *req;
...@@ -315,12 +308,9 @@ static void iso_receive(struct hpsb_host *host, int channel, quadlet_t *data, ...@@ -315,12 +308,9 @@ static void iso_receive(struct hpsb_host *host, int channel, quadlet_t *data,
hi = find_host_info(host); hi = find_host_info(host);
if (hi != NULL) { if (hi != NULL) {
list_for_each(lh, &hi->file_info_list) { list_for_each_entry(fi, &hi->file_info_list, list) {
fi = list_entry(lh, struct file_info, list); if (!(fi->listen_channels & (1ULL << channel)))
if (!(fi->listen_channels & (1ULL << channel))) {
continue; continue;
}
req = __alloc_pending_request(SLAB_ATOMIC); req = __alloc_pending_request(SLAB_ATOMIC);
if (!req) break; if (!req) break;
...@@ -355,20 +345,14 @@ static void iso_receive(struct hpsb_host *host, int channel, quadlet_t *data, ...@@ -355,20 +345,14 @@ static void iso_receive(struct hpsb_host *host, int channel, quadlet_t *data,
} }
spin_unlock_irqrestore(&host_info_lock, flags); spin_unlock_irqrestore(&host_info_lock, flags);
lh = reqs.next; list_for_each_entry(req, &reqs, list)
while (lh != &reqs) {
req = list_entry(lh, struct pending_request, list);
lh = lh->next;
queue_complete_req(req); queue_complete_req(req);
}
} }
static void fcp_request(struct hpsb_host *host, int nodeid, int direction, static void fcp_request(struct hpsb_host *host, int nodeid, int direction,
int cts, u8 *data, size_t length) int cts, u8 *data, size_t length)
{ {
unsigned long flags; unsigned long flags;
struct list_head *lh;
struct host_info *hi; struct host_info *hi;
struct file_info *fi; struct file_info *fi;
struct pending_request *req; struct pending_request *req;
...@@ -384,12 +368,9 @@ static void fcp_request(struct hpsb_host *host, int nodeid, int direction, ...@@ -384,12 +368,9 @@ static void fcp_request(struct hpsb_host *host, int nodeid, int direction,
hi = find_host_info(host); hi = find_host_info(host);
if (hi != NULL) { if (hi != NULL) {
list_for_each(lh, &hi->file_info_list) { list_for_each_entry(fi, &hi->file_info_list, list) {
fi = list_entry(lh, struct file_info, list); if (!fi->fcp_buffer)
if (!fi->fcp_buffer) {
continue; continue;
}
req = __alloc_pending_request(SLAB_ATOMIC); req = __alloc_pending_request(SLAB_ATOMIC);
if (!req) break; if (!req) break;
...@@ -424,13 +405,8 @@ static void fcp_request(struct hpsb_host *host, int nodeid, int direction, ...@@ -424,13 +405,8 @@ static void fcp_request(struct hpsb_host *host, int nodeid, int direction,
} }
spin_unlock_irqrestore(&host_info_lock, flags); spin_unlock_irqrestore(&host_info_lock, flags);
lh = reqs.next; list_for_each_entry(req, &reqs, list)
while (lh != &reqs) {
req = list_entry(lh, struct pending_request, list);
lh = lh->next;
queue_complete_req(req); queue_complete_req(req);
}
} }
...@@ -506,7 +482,6 @@ static int state_opened(struct file_info *fi, struct pending_request *req) ...@@ -506,7 +482,6 @@ static int state_opened(struct file_info *fi, struct pending_request *req)
static int state_initialized(struct file_info *fi, struct pending_request *req) static int state_initialized(struct file_info *fi, struct pending_request *req)
{ {
struct list_head *lh;
struct host_info *hi; struct host_info *hi;
struct raw1394_khost_list *khl; struct raw1394_khost_list *khl;
...@@ -528,12 +503,9 @@ static int state_initialized(struct file_info *fi, struct pending_request *req) ...@@ -528,12 +503,9 @@ static int state_initialized(struct file_info *fi, struct pending_request *req)
req->req.misc = host_count; req->req.misc = host_count;
req->data = (quadlet_t *)khl; req->data = (quadlet_t *)khl;
list_for_each(lh, &host_info_list) { list_for_each_entry(hi, &host_info_list, list) {
hi = list_entry(lh, struct host_info, list);
khl->nodes = hi->host->node_count; khl->nodes = hi->host->node_count;
strcpy(khl->name, hi->host->driver->name); strcpy(khl->name, hi->host->driver->name);
khl++; khl++;
} }
} }
...@@ -551,23 +523,17 @@ static int state_initialized(struct file_info *fi, struct pending_request *req) ...@@ -551,23 +523,17 @@ static int state_initialized(struct file_info *fi, struct pending_request *req)
break; break;
case RAW1394_REQ_SET_CARD: case RAW1394_REQ_SET_CARD:
lh = NULL;
spin_lock_irq(&host_info_lock); spin_lock_irq(&host_info_lock);
if (req->req.misc < host_count) { if (req->req.misc < host_count) {
lh = host_info_list.next; list_for_each_entry(hi, &host_info_list, list) {
while (req->req.misc--) { if (!req->req.misc--)
lh = lh->next; break;
} }
hi = list_entry(lh, struct host_info, list);
get_device(&hi->host->device); // XXX Need to handle failure case get_device(&hi->host->device); // XXX Need to handle failure case
list_add_tail(&fi->list, &hi->file_info_list); list_add_tail(&fi->list, &hi->file_info_list);
fi->host = hi->host; fi->host = hi->host;
fi->state = connected; fi->state = connected;
}
spin_unlock_irq(&host_info_lock);
if (lh != NULL) {
req->req.error = RAW1394_ERROR_NONE; req->req.error = RAW1394_ERROR_NONE;
req->req.generation = get_hpsb_generation(fi->host); req->req.generation = get_hpsb_generation(fi->host);
req->req.misc = (fi->host->node_id << 16) req->req.misc = (fi->host->node_id << 16)
...@@ -578,6 +544,7 @@ static int state_initialized(struct file_info *fi, struct pending_request *req) ...@@ -578,6 +544,7 @@ static int state_initialized(struct file_info *fi, struct pending_request *req)
} else { } else {
req->req.error = RAW1394_ERROR_INVALID_ARG; req->req.error = RAW1394_ERROR_INVALID_ARG;
} }
spin_unlock_irq(&host_info_lock);
req->req.length = 0; req->req.length = 0;
break; break;
...@@ -899,7 +866,6 @@ static int arm_read (struct hpsb_host *host, int nodeid, quadlet_t *buffer, ...@@ -899,7 +866,6 @@ static int arm_read (struct hpsb_host *host, int nodeid, quadlet_t *buffer,
u64 addr, size_t length, u16 flags) u64 addr, size_t length, u16 flags)
{ {
struct pending_request *req; struct pending_request *req;
struct list_head *lh;
struct host_info *hi; struct host_info *hi;
struct file_info *fi = NULL; struct file_info *fi = NULL;
struct list_head *entry; struct list_head *entry;
...@@ -916,8 +882,7 @@ static int arm_read (struct hpsb_host *host, int nodeid, quadlet_t *buffer, ...@@ -916,8 +882,7 @@ static int arm_read (struct hpsb_host *host, int nodeid, quadlet_t *buffer,
spin_lock(&host_info_lock); spin_lock(&host_info_lock);
hi = find_host_info(host); /* search address-entry */ hi = find_host_info(host); /* search address-entry */
if (hi != NULL) { if (hi != NULL) {
list_for_each(lh, &hi->file_info_list) { list_for_each_entry(fi, &hi->file_info_list, list) {
fi = list_entry(lh, struct file_info, list);
entry = fi->addr_list.next; entry = fi->addr_list.next;
while (entry != &(fi->addr_list)) { while (entry != &(fi->addr_list)) {
arm_addr = list_entry(entry, struct arm_addr, addr_list); arm_addr = list_entry(entry, struct arm_addr, addr_list);
...@@ -1035,7 +1000,6 @@ static int arm_write (struct hpsb_host *host, int nodeid, int destid, ...@@ -1035,7 +1000,6 @@ static int arm_write (struct hpsb_host *host, int nodeid, int destid,
quadlet_t *data, u64 addr, size_t length, u16 flags) quadlet_t *data, u64 addr, size_t length, u16 flags)
{ {
struct pending_request *req; struct pending_request *req;
struct list_head *lh;
struct host_info *hi; struct host_info *hi;
struct file_info *fi = NULL; struct file_info *fi = NULL;
struct list_head *entry; struct list_head *entry;
...@@ -1052,8 +1016,7 @@ static int arm_write (struct hpsb_host *host, int nodeid, int destid, ...@@ -1052,8 +1016,7 @@ static int arm_write (struct hpsb_host *host, int nodeid, int destid,
spin_lock(&host_info_lock); spin_lock(&host_info_lock);
hi = find_host_info(host); /* search address-entry */ hi = find_host_info(host); /* search address-entry */
if (hi != NULL) { if (hi != NULL) {
list_for_each(lh, &hi->file_info_list) { list_for_each_entry(fi, &hi->file_info_list, list) {
fi = list_entry(lh, struct file_info, list);
entry = fi->addr_list.next; entry = fi->addr_list.next;
while (entry != &(fi->addr_list)) { while (entry != &(fi->addr_list)) {
arm_addr = list_entry(entry, struct arm_addr, addr_list); arm_addr = list_entry(entry, struct arm_addr, addr_list);
...@@ -1162,7 +1125,6 @@ static int arm_lock (struct hpsb_host *host, int nodeid, quadlet_t *store, ...@@ -1162,7 +1125,6 @@ static int arm_lock (struct hpsb_host *host, int nodeid, quadlet_t *store,
u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, u16 flags) u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, u16 flags)
{ {
struct pending_request *req; struct pending_request *req;
struct list_head *lh;
struct host_info *hi; struct host_info *hi;
struct file_info *fi = NULL; struct file_info *fi = NULL;
struct list_head *entry; struct list_head *entry;
...@@ -1188,8 +1150,7 @@ static int arm_lock (struct hpsb_host *host, int nodeid, quadlet_t *store, ...@@ -1188,8 +1150,7 @@ static int arm_lock (struct hpsb_host *host, int nodeid, quadlet_t *store,
spin_lock(&host_info_lock); spin_lock(&host_info_lock);
hi = find_host_info(host); /* search address-entry */ hi = find_host_info(host); /* search address-entry */
if (hi != NULL) { if (hi != NULL) {
list_for_each(lh, &hi->file_info_list) { list_for_each_entry(fi, &hi->file_info_list, list) {
fi = list_entry(lh, struct file_info, list);
entry = fi->addr_list.next; entry = fi->addr_list.next;
while (entry != &(fi->addr_list)) { while (entry != &(fi->addr_list)) {
arm_addr = list_entry(entry, struct arm_addr, addr_list); arm_addr = list_entry(entry, struct arm_addr, addr_list);
...@@ -1360,7 +1321,6 @@ static int arm_lock64 (struct hpsb_host *host, int nodeid, octlet_t *store, ...@@ -1360,7 +1321,6 @@ static int arm_lock64 (struct hpsb_host *host, int nodeid, octlet_t *store,
u64 addr, octlet_t data, octlet_t arg, int ext_tcode, u16 flags) u64 addr, octlet_t data, octlet_t arg, int ext_tcode, u16 flags)
{ {
struct pending_request *req; struct pending_request *req;
struct list_head *lh;
struct host_info *hi; struct host_info *hi;
struct file_info *fi = NULL; struct file_info *fi = NULL;
struct list_head *entry; struct list_head *entry;
...@@ -1395,8 +1355,7 @@ static int arm_lock64 (struct hpsb_host *host, int nodeid, octlet_t *store, ...@@ -1395,8 +1355,7 @@ static int arm_lock64 (struct hpsb_host *host, int nodeid, octlet_t *store,
spin_lock(&host_info_lock); spin_lock(&host_info_lock);
hi = find_host_info(host); /* search addressentry in file_info's for host */ hi = find_host_info(host); /* search addressentry in file_info's for host */
if (hi != NULL) { if (hi != NULL) {
list_for_each(lh, &hi->file_info_list) { list_for_each_entry(fi, &hi->file_info_list, list) {
fi = list_entry(lh, struct file_info, list);
entry = fi->addr_list.next; entry = fi->addr_list.next;
while (entry != &(fi->addr_list)) { while (entry != &(fi->addr_list)) {
arm_addr = list_entry(entry, struct arm_addr, addr_list); arm_addr = list_entry(entry, struct arm_addr, addr_list);
...@@ -1567,7 +1526,6 @@ static int arm_register(struct file_info *fi, struct pending_request *req) ...@@ -1567,7 +1526,6 @@ static int arm_register(struct file_info *fi, struct pending_request *req)
{ {
int retval; int retval;
struct arm_addr *addr; struct arm_addr *addr;
struct list_head *lh, *lh_1, *lh_2;
struct host_info *hi; struct host_info *hi;
struct file_info *fi_hlp = NULL; struct file_info *fi_hlp = NULL;
struct list_head *entry; struct list_head *entry;
...@@ -1631,8 +1589,7 @@ static int arm_register(struct file_info *fi, struct pending_request *req) ...@@ -1631,8 +1589,7 @@ static int arm_register(struct file_info *fi, struct pending_request *req)
same_host = 0; same_host = 0;
another_host = 0; another_host = 0;
/* same host with address-entry containing same addressrange ? */ /* same host with address-entry containing same addressrange ? */
list_for_each(lh, &hi->file_info_list) { list_for_each_entry(fi_hlp, &hi->file_info_list, list) {
fi_hlp = list_entry(lh, struct file_info, list);
entry = fi_hlp->addr_list.next; entry = fi_hlp->addr_list.next;
while (entry != &(fi_hlp->addr_list)) { while (entry != &(fi_hlp->addr_list)) {
arm_addr = list_entry(entry, struct arm_addr, addr_list); arm_addr = list_entry(entry, struct arm_addr, addr_list);
...@@ -1657,11 +1614,9 @@ static int arm_register(struct file_info *fi, struct pending_request *req) ...@@ -1657,11 +1614,9 @@ static int arm_register(struct file_info *fi, struct pending_request *req)
return (-EALREADY); return (-EALREADY);
} }
/* another host with valid address-entry containing same addressrange */ /* another host with valid address-entry containing same addressrange */
list_for_each(lh_1, &host_info_list) { list_for_each_entry(hi, &host_info_list, list) {
hi = list_entry(lh_1, struct host_info, list);
if (hi->host != fi->host) { if (hi->host != fi->host) {
list_for_each(lh_2, &hi->file_info_list) { list_for_each_entry(fi_hlp, &hi->file_info_list, list) {
fi_hlp = list_entry(lh_2, struct file_info, list);
entry = fi_hlp->addr_list.next; entry = fi_hlp->addr_list.next;
while (entry != &(fi_hlp->addr_list)) { while (entry != &(fi_hlp->addr_list)) {
arm_addr = list_entry(entry, struct arm_addr, addr_list); arm_addr = list_entry(entry, struct arm_addr, addr_list);
...@@ -1720,7 +1675,6 @@ static int arm_unregister(struct file_info *fi, struct pending_request *req) ...@@ -1720,7 +1675,6 @@ static int arm_unregister(struct file_info *fi, struct pending_request *req)
int retval = 0; int retval = 0;
struct list_head *entry; struct list_head *entry;
struct arm_addr *addr = NULL; struct arm_addr *addr = NULL;
struct list_head *lh_1, *lh_2;
struct host_info *hi; struct host_info *hi;
struct file_info *fi_hlp = NULL; struct file_info *fi_hlp = NULL;
struct arm_addr *arm_addr = NULL; struct arm_addr *arm_addr = NULL;
...@@ -1751,11 +1705,9 @@ static int arm_unregister(struct file_info *fi, struct pending_request *req) ...@@ -1751,11 +1705,9 @@ static int arm_unregister(struct file_info *fi, struct pending_request *req)
another_host = 0; another_host = 0;
/* another host with valid address-entry containing /* another host with valid address-entry containing
same addressrange */ same addressrange */
list_for_each(lh_1, &host_info_list) { list_for_each_entry(hi, &host_info_list, list) {
hi = list_entry(lh_1, struct host_info, list);
if (hi->host != fi->host) { if (hi->host != fi->host) {
list_for_each(lh_2, &hi->file_info_list) { list_for_each_entry(fi_hlp, &hi->file_info_list, list) {
fi_hlp = list_entry(lh_2, struct file_info, list);
entry = fi_hlp->addr_list.next; entry = fi_hlp->addr_list.next;
while (entry != &(fi_hlp->addr_list)) { while (entry != &(fi_hlp->addr_list)) {
arm_addr = list_entry(entry, arm_addr = list_entry(entry,
...@@ -2244,15 +2196,11 @@ static ssize_t raw1394_write(struct file *file, const char *buffer, size_t count ...@@ -2244,15 +2196,11 @@ static ssize_t raw1394_write(struct file *file, const char *buffer, size_t count
* completion queue (reqlists_lock must be taken) */ * completion queue (reqlists_lock must be taken) */
static inline int __rawiso_event_in_queue(struct file_info *fi) static inline int __rawiso_event_in_queue(struct file_info *fi)
{ {
struct list_head *lh;
struct pending_request *req; struct pending_request *req;
list_for_each(lh, &fi->req_complete) { list_for_each_entry(req, &fi->req_complete, list)
req = list_entry(lh, struct pending_request, list); if (req->req.type == RAW1394_REQ_RAWISO_ACTIVITY)
if (req->req.type == RAW1394_REQ_RAWISO_ACTIVITY) {
return 1; return 1;
}
}
return 0; return 0;
} }
...@@ -2286,15 +2234,14 @@ static void queue_rawiso_event(struct file_info *fi) ...@@ -2286,15 +2234,14 @@ static void queue_rawiso_event(struct file_info *fi)
static void rawiso_activity_cb(struct hpsb_iso *iso) static void rawiso_activity_cb(struct hpsb_iso *iso)
{ {
unsigned long flags; unsigned long flags;
struct list_head *lh;
struct host_info *hi; struct host_info *hi;
struct file_info *fi;
spin_lock_irqsave(&host_info_lock, flags); spin_lock_irqsave(&host_info_lock, flags);
hi = find_host_info(iso->host); hi = find_host_info(iso->host);
if (hi != NULL) { if (hi != NULL) {
list_for_each(lh, &hi->file_info_list) { list_for_each_entry(fi, &hi->file_info_list, list) {
struct file_info *fi = list_entry(lh, struct file_info, list);
if (fi->iso_handle == iso) if (fi->iso_handle == iso)
queue_rawiso_event(fi); queue_rawiso_event(fi);
} }
...@@ -2614,7 +2561,6 @@ static int raw1394_release(struct inode *inode, struct file *file) ...@@ -2614,7 +2561,6 @@ static int raw1394_release(struct inode *inode, struct file *file)
int retval = 0; int retval = 0;
struct list_head *entry; struct list_head *entry;
struct arm_addr *addr = NULL; struct arm_addr *addr = NULL;
struct list_head *lh_1, *lh_2;
struct host_info *hi; struct host_info *hi;
struct file_info *fi_hlp = NULL; struct file_info *fi_hlp = NULL;
struct arm_addr *arm_addr = NULL; struct arm_addr *arm_addr = NULL;
...@@ -2644,11 +2590,9 @@ static int raw1394_release(struct inode *inode, struct file *file) ...@@ -2644,11 +2590,9 @@ static int raw1394_release(struct inode *inode, struct file *file)
addr = list_entry(lh, struct arm_addr, addr_list); addr = list_entry(lh, struct arm_addr, addr_list);
/* another host with valid address-entry containing /* another host with valid address-entry containing
same addressrange? */ same addressrange? */
list_for_each(lh_1, &host_info_list) { list_for_each_entry(hi, &host_info_list, list) {
hi = list_entry(lh_1, struct host_info, list);
if (hi->host != fi->host) { if (hi->host != fi->host) {
list_for_each(lh_2, &hi->file_info_list) { list_for_each_entry(fi_hlp, &hi->file_info_list, list) {
fi_hlp = list_entry(lh_2, struct file_info, list);
entry = fi_hlp->addr_list.next; entry = fi_hlp->addr_list.next;
while (entry != &(fi_hlp->addr_list)) { while (entry != &(fi_hlp->addr_list)) {
arm_addr = list_entry(entry, arm_addr = list_entry(entry,
......
...@@ -470,14 +470,12 @@ static void sbp2util_remove_command_orb_pool(struct scsi_id_instance_data *scsi_ ...@@ -470,14 +470,12 @@ static void sbp2util_remove_command_orb_pool(struct scsi_id_instance_data *scsi_
static struct sbp2_command_info *sbp2util_find_command_for_orb( static struct sbp2_command_info *sbp2util_find_command_for_orb(
struct scsi_id_instance_data *scsi_id, dma_addr_t orb) struct scsi_id_instance_data *scsi_id, dma_addr_t orb)
{ {
struct list_head *lh;
struct sbp2_command_info *command; struct sbp2_command_info *command;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags);
if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) {
list_for_each(lh, &scsi_id->sbp2_command_orb_inuse) { list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) {
command = list_entry(lh, struct sbp2_command_info, list);
if (command->command_orb_dma == orb) { if (command->command_orb_dma == orb) {
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
return (command); return (command);
...@@ -497,14 +495,12 @@ static struct sbp2_command_info *sbp2util_find_command_for_orb( ...@@ -497,14 +495,12 @@ static struct sbp2_command_info *sbp2util_find_command_for_orb(
*/ */
static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_instance_data *scsi_id, void *SCpnt) static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_instance_data *scsi_id, void *SCpnt)
{ {
struct list_head *lh;
struct sbp2_command_info *command; struct sbp2_command_info *command;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags);
if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) {
list_for_each(lh, &scsi_id->sbp2_command_orb_inuse) { list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) {
command = list_entry(lh, struct sbp2_command_info, list);
if (command->Current_SCpnt == SCpnt) { if (command->Current_SCpnt == SCpnt) {
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
return (command); return (command);
...@@ -1563,7 +1559,6 @@ static void sbp2_parse_unit_directory(struct scsi_id_group *scsi_group, ...@@ -1563,7 +1559,6 @@ static void sbp2_parse_unit_directory(struct scsi_id_group *scsi_group,
struct csr1212_keyval *kv; struct csr1212_keyval *kv;
struct csr1212_dentry *dentry; struct csr1212_dentry *dentry;
struct scsi_id_instance_data *scsi_id; struct scsi_id_instance_data *scsi_id;
struct list_head *lh;
u64 management_agent_addr; u64 management_agent_addr;
u32 command_set_spec_id, command_set, unit_characteristics, u32 command_set_spec_id, command_set, unit_characteristics,
firmware_revision, workarounds; firmware_revision, workarounds;
...@@ -1706,9 +1701,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_group *scsi_group, ...@@ -1706,9 +1701,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_group *scsi_group,
} }
/* Update the generic fields in all the LUN's */ /* Update the generic fields in all the LUN's */
list_for_each (lh, &scsi_group->scsi_id_list) { list_for_each_entry(scsi_id, &scsi_group->scsi_id_list, list) {
scsi_id = list_entry(lh, struct scsi_id_instance_data, list);
scsi_id->sbp2_management_agent_addr = management_agent_addr; scsi_id->sbp2_management_agent_addr = management_agent_addr;
scsi_id->sbp2_command_set_spec_id = command_set_spec_id; scsi_id->sbp2_command_set_spec_id = command_set_spec_id;
scsi_id->sbp2_command_set = command_set; scsi_id->sbp2_command_set = command_set;
......
...@@ -476,11 +476,9 @@ static void initialize_dma_ir_ctx(struct dma_iso_ctx *d, int tag, int flags) ...@@ -476,11 +476,9 @@ static void initialize_dma_ir_ctx(struct dma_iso_ctx *d, int tag, int flags)
static struct dma_iso_ctx * static struct dma_iso_ctx *
find_ctx(struct list_head *list, int type, int channel) find_ctx(struct list_head *list, int type, int channel)
{ {
struct list_head *lh;
list_for_each(lh, list) {
struct dma_iso_ctx *ctx; struct dma_iso_ctx *ctx;
ctx = list_entry(lh, struct dma_iso_ctx, link);
list_for_each_entry(ctx, list, link) {
if (ctx->type == type && ctx->channel == channel) if (ctx->type == type && ctx->channel == channel)
return ctx; return ctx;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment