diff options
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/core-cdev.c | 20 | ||||
-rw-r--r-- | drivers/firewire/core-device.c | 7 | ||||
-rw-r--r-- | drivers/firewire/net.c | 14 | ||||
-rw-r--r-- | drivers/firewire/ohci.c | 2 |
4 files changed, 21 insertions, 22 deletions
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index f8d2287..27ac423 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -487,27 +487,28 @@ static int ioctl_get_info(struct client *client, union ioctl_arg *arg) static int add_client_resource(struct client *client, struct client_resource *resource, gfp_t gfp_mask) { + bool preload = gfp_mask & __GFP_WAIT; unsigned long flags; int ret; - retry: - if (idr_pre_get(&client->resource_idr, gfp_mask) == 0) - return -ENOMEM; - + if (preload) + idr_preload(gfp_mask); spin_lock_irqsave(&client->lock, flags); + if (client->in_shutdown) ret = -ECANCELED; else - ret = idr_get_new(&client->resource_idr, resource, - &resource->handle); + ret = idr_alloc(&client->resource_idr, resource, 0, 0, + GFP_NOWAIT); if (ret >= 0) { + resource->handle = ret; client_get(client); schedule_if_iso_resource(resource); } - spin_unlock_irqrestore(&client->lock, flags); - if (ret == -EAGAIN) - goto retry; + spin_unlock_irqrestore(&client->lock, flags); + if (preload) + idr_preload_end(); return ret < 0 ? ret : 0; } @@ -1779,7 +1780,6 @@ static int fw_device_op_release(struct inode *inode, struct file *file) wait_event(client->tx_flush_wait, !has_outbound_transactions(client)); idr_for_each(&client->resource_idr, shutdown_resource, client); - idr_remove_all(&client->resource_idr); idr_destroy(&client->resource_idr); list_for_each_entry_safe(event, next_event, &client->event_list, link) diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index 3873d53..03ce7d9 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c @@ -1017,12 +1017,11 @@ static void fw_device_init(struct work_struct *work) fw_device_get(device); down_write(&fw_device_rwsem); - ret = idr_pre_get(&fw_device_idr, GFP_KERNEL) ? - idr_get_new(&fw_device_idr, device, &minor) : - -ENOMEM; + minor = idr_alloc(&fw_device_idr, device, 0, 1 << MINORBITS, + GFP_KERNEL); up_write(&fw_device_rwsem); - if (ret < 0) + if (minor < 0) goto error; device->device.bus = &fw_bus_type; diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index e7a711f5..2b27bff 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c @@ -270,7 +270,7 @@ static int fwnet_header_cache(const struct neighbour *neigh, if (type == cpu_to_be16(ETH_P_802_3)) return -1; net = neigh->dev; - h = (struct fwnet_header *)((u8 *)hh->hh_data + 16 - sizeof(*h)); + h = (struct fwnet_header *)((u8 *)hh->hh_data + HH_DATA_OFF(sizeof(*h))); h->h_proto = type; memcpy(h->h_dest, neigh->ha, net->addr_len); hh->hh_len = FWNET_HLEN; @@ -282,7 +282,7 @@ static int fwnet_header_cache(const struct neighbour *neigh, static void fwnet_header_cache_update(struct hh_cache *hh, const struct net_device *net, const unsigned char *haddr) { - memcpy((u8 *)hh->hh_data + 16 - FWNET_HLEN, haddr, net->addr_len); + memcpy((u8 *)hh->hh_data + HH_DATA_OFF(FWNET_HLEN), haddr, net->addr_len); } static int fwnet_header_parse(const struct sk_buff *skb, unsigned char *haddr) @@ -398,11 +398,11 @@ static struct fwnet_partial_datagram *fwnet_pd_new(struct net_device *net, new->datagram_label = datagram_label; new->datagram_size = dg_size; - new->skb = dev_alloc_skb(dg_size + net->hard_header_len + 15); + new->skb = dev_alloc_skb(dg_size + LL_RESERVED_SPACE(net)); if (new->skb == NULL) goto fail_w_fi; - skb_reserve(new->skb, (net->hard_header_len + 15) & ~15); + skb_reserve(new->skb, LL_RESERVED_SPACE(net)); new->pbuf = skb_put(new->skb, dg_size); memcpy(new->pbuf + frag_off, frag_buf, frag_len); list_add_tail(&new->pd_link, &peer->pd_list); @@ -520,7 +520,7 @@ static int fwnet_finish_incoming_packet(struct net_device *net, dev = netdev_priv(net); /* Write metadata, and then pass to the receive level */ skb->dev = net; - skb->ip_summed = CHECKSUM_UNNECESSARY; /* don't check it */ + skb->ip_summed = CHECKSUM_NONE; /* * Parse the encapsulation header. This actually does the job of @@ -690,14 +690,14 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, buf++; len -= RFC2374_UNFRAG_HDR_SIZE; - skb = dev_alloc_skb(len + net->hard_header_len + 15); + skb = dev_alloc_skb(len + LL_RESERVED_SPACE(net)); if (unlikely(!skb)) { dev_err(&net->dev, "out of memory\n"); net->stats.rx_dropped++; return -ENOMEM; } - skb_reserve(skb, (net->hard_header_len + 15) & ~15); + skb_reserve(skb, LL_RESERVED_SPACE(net)); memcpy(skb_put(skb, len), buf, len); return fwnet_finish_incoming_packet(net, skb, source_node_id, diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 6ce6e07..45912e6 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -329,7 +329,7 @@ module_param_named(quirks, param_quirks, int, 0644); MODULE_PARM_DESC(quirks, "Chip quirks (default = 0" ", nonatomic cycle timer = " __stringify(QUIRK_CYCLE_TIMER) ", reset packet generation = " __stringify(QUIRK_RESET_PACKET) - ", AR/selfID endianess = " __stringify(QUIRK_BE_HEADERS) + ", AR/selfID endianness = " __stringify(QUIRK_BE_HEADERS) ", no 1394a enhancements = " __stringify(QUIRK_NO_1394A) ", disable MSI = " __stringify(QUIRK_NO_MSI) ", TI SLLZ059 erratum = " __stringify(QUIRK_TI_SLLZ059) |