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)
......
This diff is collapsed.
...@@ -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; struct dma_iso_ctx *ctx;
list_for_each(lh, list) { list_for_each_entry(ctx, list, link) {
struct dma_iso_ctx *ctx;
ctx = list_entry(lh, struct dma_iso_ctx, 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