diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2013-03-07 20:43:25 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2013-03-13 11:11:11 -0400 |
commit | f2090594dd28c033e0a9a267240ffca6d5afbd84 (patch) | |
tree | 779f4ed97ff7f574806418e10f8c6366831ccafa /drivers/firewire | |
parent | f60bac4bc9f8c6b20b27a2be210a69e2f256f0a5 (diff) |
firewire net: Omit checking dev->broadcast_rcv_context in fwnet_broadcast_start().
dev->broadcast_rcv_context is always non-NULL if dev->broadcast_state is
not FWNET_BROADCAST_ERROR.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/net.c | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index efed4a65fb06..d8cb6ac31044 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c | |||
@@ -1154,6 +1154,7 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) | |||
1154 | unsigned max_receive; | 1154 | unsigned max_receive; |
1155 | struct fw_iso_packet packet; | 1155 | struct fw_iso_packet packet; |
1156 | unsigned long offset; | 1156 | unsigned long offset; |
1157 | void **ptrptr; | ||
1157 | unsigned u; | 1158 | unsigned u; |
1158 | 1159 | ||
1159 | if (dev->broadcast_state != FWNET_BROADCAST_ERROR) | 1160 | if (dev->broadcast_state != FWNET_BROADCAST_ERROR) |
@@ -1162,42 +1163,36 @@ static int fwnet_broadcast_start(struct fwnet_device *dev) | |||
1162 | max_receive = 1U << (dev->card->max_receive + 1); | 1163 | max_receive = 1U << (dev->card->max_receive + 1); |
1163 | num_packets = (FWNET_ISO_PAGE_COUNT * PAGE_SIZE) / max_receive; | 1164 | num_packets = (FWNET_ISO_PAGE_COUNT * PAGE_SIZE) / max_receive; |
1164 | 1165 | ||
1165 | if (!dev->broadcast_rcv_context) { | 1166 | context = fw_iso_context_create(dev->card, FW_ISO_CONTEXT_RECEIVE, |
1166 | void **ptrptr; | 1167 | IEEE1394_BROADCAST_CHANNEL, |
1167 | 1168 | dev->card->link_speed, 8, | |
1168 | context = fw_iso_context_create(dev->card, | 1169 | fwnet_receive_broadcast, dev); |
1169 | FW_ISO_CONTEXT_RECEIVE, IEEE1394_BROADCAST_CHANNEL, | 1170 | if (IS_ERR(context)) { |
1170 | dev->card->link_speed, 8, fwnet_receive_broadcast, dev); | 1171 | retval = PTR_ERR(context); |
1171 | if (IS_ERR(context)) { | 1172 | goto failed_context_create; |
1172 | retval = PTR_ERR(context); | 1173 | } |
1173 | goto failed_context_create; | ||
1174 | } | ||
1175 | 1174 | ||
1176 | retval = fw_iso_buffer_init(&dev->broadcast_rcv_buffer, | 1175 | retval = fw_iso_buffer_init(&dev->broadcast_rcv_buffer, dev->card, |
1177 | dev->card, FWNET_ISO_PAGE_COUNT, DMA_FROM_DEVICE); | 1176 | FWNET_ISO_PAGE_COUNT, DMA_FROM_DEVICE); |
1178 | if (retval < 0) | 1177 | if (retval < 0) |
1179 | goto failed_buffer_init; | 1178 | goto failed_buffer_init; |
1180 | 1179 | ||
1181 | ptrptr = kmalloc(sizeof(void *) * num_packets, GFP_KERNEL); | 1180 | ptrptr = kmalloc(sizeof(void *) * num_packets, GFP_KERNEL); |
1182 | if (!ptrptr) { | 1181 | if (!ptrptr) { |
1183 | retval = -ENOMEM; | 1182 | retval = -ENOMEM; |
1184 | goto failed_ptrs_alloc; | 1183 | goto failed_ptrs_alloc; |
1185 | } | 1184 | } |
1186 | 1185 | ||
1187 | dev->broadcast_rcv_buffer_ptrs = ptrptr; | 1186 | dev->broadcast_rcv_buffer_ptrs = ptrptr; |
1188 | for (u = 0; u < FWNET_ISO_PAGE_COUNT; u++) { | 1187 | for (u = 0; u < FWNET_ISO_PAGE_COUNT; u++) { |
1189 | void *ptr; | 1188 | void *ptr; |
1190 | unsigned v; | 1189 | unsigned v; |
1191 | 1190 | ||
1192 | ptr = kmap(dev->broadcast_rcv_buffer.pages[u]); | 1191 | ptr = kmap(dev->broadcast_rcv_buffer.pages[u]); |
1193 | for (v = 0; v < num_packets / FWNET_ISO_PAGE_COUNT; v++) | 1192 | for (v = 0; v < num_packets / FWNET_ISO_PAGE_COUNT; v++) |
1194 | *ptrptr++ = (void *) | 1193 | *ptrptr++ = (void *) ((char *)ptr + v * max_receive); |
1195 | ((char *)ptr + v * max_receive); | ||
1196 | } | ||
1197 | dev->broadcast_rcv_context = context; | ||
1198 | } else { | ||
1199 | context = dev->broadcast_rcv_context; | ||
1200 | } | 1194 | } |
1195 | dev->broadcast_rcv_context = context; | ||
1201 | 1196 | ||
1202 | packet.payload_length = max_receive; | 1197 | packet.payload_length = max_receive; |
1203 | packet.interrupt = 1; | 1198 | packet.interrupt = 1; |