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)
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)
packet_list_free(s->current_packet_list, s);
list_for_each_safe(lh, next, &s->dma_packet_lists)
packet_list_free(list_entry(lh, struct packet_list, link), s);
list_for_each_safe(lh, next, &s->free_packet_lists)
packet_list_free(list_entry(lh, struct packet_list, link), s);
list_for_each_entry_safe(packet_l, packet_l_next, &s->dma_packet_lists, link)
packet_list_free(packet_l, s);
list_for_each_entry_safe(packet_l, packet_l_next, &s->free_packet_lists, link)
packet_list_free(packet_l, s);
if (s->packet_pool != NULL)
pci_pool_destroy(s->packet_pool);
......
......@@ -1801,15 +1801,12 @@ static int dv1394_open(struct inode *inode, struct file *file)
} else {
/* look up the card by ID */
struct list_head *lh;
unsigned long flags;
spin_lock_irqsave(&dv1394_cards_lock, flags);
if (!list_empty(&dv1394_cards)) {
struct video_card *p;
list_for_each(lh, &dv1394_cards) {
p = list_entry(lh, struct video_card, list);
list_for_each_entry(p, &dv1394_cards, list) {
if ((p->id) == ieee1394_file_to_instance(file)) {
video = p;
break;
......@@ -2374,7 +2371,6 @@ static void dv1394_host_reset(struct hpsb_host *host)
struct ti_ohci *ohci;
struct video_card *video = NULL;
unsigned long flags;
struct list_head *lh;
/* We only work with the OHCI-1394 driver */
if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME))
......@@ -2386,8 +2382,7 @@ static void dv1394_host_reset(struct hpsb_host *host)
/* find the corresponding video_cards */
spin_lock_irqsave(&dv1394_cards_lock, flags);
if (!list_empty(&dv1394_cards)) {
list_for_each(lh, &dv1394_cards) {
video = list_entry(lh, struct video_card, list);
list_for_each_entry(video, &dv1394_cards, list) {
if ((video->id >> 2) == ohci->id)
break;
}
......
......@@ -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)
{
struct list_head *lh;
struct fragment_info *fi;
list_for_each(lh, frag_list) {
fi = list_entry(lh, struct fragment_info, list);
list_for_each_entry(fi, frag_list, list) {
if ( ! ((offset > (fi->offset + fi->len - 1)) ||
((offset + len - 1) < fi->offset)))
return 1;
......@@ -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)
{
struct list_head *lh;
struct partial_datagram *pd;
list_for_each(lh, pdgl) {
pd = list_entry(lh, struct partial_datagram, list);
list_for_each_entry(pd, pdgl, list) {
if (pd->dgl == dgl)
return lh;
return &pd->list;
}
return NULL;
}
......
......@@ -56,14 +56,12 @@ static struct hl_host_info *hl_get_hostinfo(struct hpsb_highlevel *hl,
struct hpsb_host *host)
{
struct hl_host_info *hi = NULL;
struct list_head *lh;
if (!hl || !host)
return NULL;
read_lock(&hl->host_info_lock);
list_for_each (lh, &hl->host_info_list) {
hi = list_entry(lh, struct hl_host_info, list);
list_for_each_entry(hi, &hl->host_info_list, list) {
if (hi->host == host)
break;
hi = NULL;
......@@ -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)
{
struct list_head *lh;
struct hl_host_info *hi;
void *data = NULL;
......@@ -196,8 +193,7 @@ void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key)
return NULL;
read_lock(&hl->host_info_lock);
list_for_each (lh, &hl->host_info_list) {
hi = list_entry(lh, struct hl_host_info, list);
list_for_each_entry(hi, &hl->host_info_list, list) {
if (hi->key == key) {
data = hi->data;
break;
......@@ -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 list_head *lh;
struct hl_host_info *hi;
struct hpsb_host *host = NULL;
......@@ -219,8 +214,7 @@ struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, unsigned long k
return NULL;
read_lock(&hl->host_info_lock);
list_for_each (lh, &hl->host_info_list) {
hi = list_entry(lh, struct hl_host_info, list);
list_for_each_entry(hi, &hl->host_info_list, list) {
if (hi->key == key) {
host = hi->host;
break;
......
......@@ -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)
{
unsigned long flags;
struct hpsb_packet *packet;
struct list_head *lh, *tlh;
struct hpsb_packet *packet, *packet_next;
LIST_HEAD(llist);
host->driver->devctl(host, CANCEL_REQUESTS, 0);
......@@ -946,8 +945,7 @@ void abort_requests(struct hpsb_host *host)
INIT_LIST_HEAD(&host->pending_packets);
spin_unlock_irqrestore(&host->pending_pkt_lock, flags);
list_for_each_safe(lh, tlh, &llist) {
packet = list_entry(lh, struct hpsb_packet, list);
list_for_each_entry_safe(packet, packet_next, &llist, list) {
list_del(&packet->list);
packet->state = hpsb_complete;
packet->ack_code = ACKX_ABORTED;
......@@ -959,9 +957,8 @@ void abort_timedouts(unsigned long __opaque)
{
struct hpsb_host *host = (struct hpsb_host *)__opaque;
unsigned long flags;
struct hpsb_packet *packet;
struct hpsb_packet *packet, *packet_next;
unsigned long expire;
struct list_head *lh, *tlh;
LIST_HEAD(expiredlist);
spin_lock_irqsave(&host->csr.lock, flags);
......@@ -970,8 +967,7 @@ void abort_timedouts(unsigned long __opaque)
spin_lock_irqsave(&host->pending_pkt_lock, flags);
list_for_each_safe(lh, tlh, &host->pending_packets) {
packet = list_entry(lh, struct hpsb_packet, list);
list_for_each_entry_safe(packet, packet_next, &host->pending_packets, list) {
if (time_before(packet->sendtime + expire, jiffies)) {
list_del(&packet->list);
list_add(&packet->list, &expiredlist);
......@@ -983,8 +979,7 @@ void abort_timedouts(unsigned long __opaque)
spin_unlock_irqrestore(&host->pending_pkt_lock, flags);
list_for_each_safe(lh, tlh, &expiredlist) {
packet = list_entry(lh, struct hpsb_packet, list);
list_for_each_entry_safe(packet, packet_next, &expiredlist, list) {
list_del(&packet->list);
packet->state = hpsb_complete;
packet->ack_code = ACKX_TIMEOUT;
......
......@@ -2207,14 +2207,12 @@ static void ohci_schedule_iso_tasklets(struct ti_ohci *ohci,
quadlet_t rx_event,
quadlet_t tx_event)
{
struct list_head *lh;
struct ohci1394_iso_tasklet *t;
unsigned long mask;
spin_lock(&ohci->iso_tasklet_list_lock);
list_for_each(lh, &ohci->iso_tasklet_list) {
t = list_entry(lh, struct ohci1394_iso_tasklet, link);
list_for_each_entry(t, &ohci->iso_tasklet_list, link) {
mask = 1 << t->context;
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_
static struct sbp2_command_info *sbp2util_find_command_for_orb(
struct scsi_id_instance_data *scsi_id, dma_addr_t orb)
{
struct list_head *lh;
struct sbp2_command_info *command;
unsigned long flags;
spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags);
if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) {
list_for_each(lh, &scsi_id->sbp2_command_orb_inuse) {
command = list_entry(lh, struct sbp2_command_info, list);
list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) {
if (command->command_orb_dma == orb) {
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
return (command);
......@@ -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)
{
struct list_head *lh;
struct sbp2_command_info *command;
unsigned long flags;
spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags);
if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) {
list_for_each(lh, &scsi_id->sbp2_command_orb_inuse) {
command = list_entry(lh, struct sbp2_command_info, list);
list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) {
if (command->Current_SCpnt == SCpnt) {
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
return (command);
......@@ -1563,7 +1559,6 @@ static void sbp2_parse_unit_directory(struct scsi_id_group *scsi_group,
struct csr1212_keyval *kv;
struct csr1212_dentry *dentry;
struct scsi_id_instance_data *scsi_id;
struct list_head *lh;
u64 management_agent_addr;
u32 command_set_spec_id, command_set, unit_characteristics,
firmware_revision, workarounds;
......@@ -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 */
list_for_each (lh, &scsi_group->scsi_id_list) {
scsi_id = list_entry(lh, struct scsi_id_instance_data, list);
list_for_each_entry(scsi_id, &scsi_group->scsi_id_list, list) {
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 = command_set;
......
......@@ -476,11 +476,9 @@ static void initialize_dma_ir_ctx(struct dma_iso_ctx *d, int tag, int flags)
static struct dma_iso_ctx *
find_ctx(struct list_head *list, int type, int channel)
{
struct list_head *lh;
struct dma_iso_ctx *ctx;
list_for_each(lh, list) {
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)
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