Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314526
b: refs/heads/master
c: 7500673
h: refs/heads/master
v: v3
  • Loading branch information
Tushar Dave authored and Jeff Kirsher committed Jun 20, 2012
1 parent c243633 commit 76ebb14
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 45 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: da55737467c1c3bc02271039c088171d82e0796f
refs/heads/master: 7500673be30f9467cd1a0e065c93e75c5213b44d
29 changes: 22 additions & 7 deletions trunk/drivers/net/can/c_can/c_can_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/clk.h>
#include <linux/pci.h>

#include <linux/can/dev.h>
Expand All @@ -29,7 +30,7 @@ struct c_can_pci_data {
enum c_can_dev_id type;
/* Set the register alignment in the memory */
enum c_can_pci_reg_align reg_align;
/* Set the frequency */
/* Set the frequency if clk is not usable */
unsigned int freq;
};

Expand Down Expand Up @@ -70,6 +71,7 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
struct c_can_priv *priv;
struct net_device *dev;
void __iomem *addr;
struct clk *clk;
int ret;

ret = pci_enable_device(pdev);
Expand Down Expand Up @@ -111,11 +113,18 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
priv->base = addr;

if (!c_can_pci_data->freq) {
dev_err(&pdev->dev, "no clock frequency defined\n");
ret = -ENODEV;
goto out_free_c_can;
/* get the appropriate clk */
clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "no clock defined\n");
ret = -ENODEV;
goto out_free_c_can;
}
priv->can.clock.freq = clk_get_rate(clk);
priv->priv = clk;
} else {
priv->can.clock.freq = c_can_pci_data->freq;
priv->priv = NULL;
}

/* Configure CAN type */
Expand All @@ -129,7 +138,7 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
break;
default:
ret = -EINVAL;
goto out_free_c_can;
goto out_free_clock;
}

/* Configure access to registers */
Expand All @@ -144,21 +153,24 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
break;
default:
ret = -EINVAL;
goto out_free_c_can;
goto out_free_clock;
}

ret = register_c_can_dev(dev);
if (ret) {
dev_err(&pdev->dev, "registering %s failed (err=%d)\n",
KBUILD_MODNAME, ret);
goto out_free_c_can;
goto out_free_clock;
}

dev_dbg(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
KBUILD_MODNAME, priv->regs, dev->irq);

return 0;

out_free_clock:
if (priv->priv)
clk_put(priv->priv);
out_free_c_can:
pci_set_drvdata(pdev, NULL);
free_c_can_dev(dev);
Expand All @@ -181,6 +193,9 @@ static void __devexit c_can_pci_remove(struct pci_dev *pdev)

unregister_c_can_dev(dev);

if (priv->priv)
clk_put(priv->priv);

pci_set_drvdata(pdev, NULL);
free_c_can_dev(dev);

Expand Down
12 changes: 6 additions & 6 deletions trunk/drivers/net/ethernet/intel/e1000/e1000_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1078,18 +1078,18 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
netdev->priv_flags |= IFF_SUPP_NOFCS;

netdev->features |= netdev->hw_features;
netdev->hw_features |= NETIF_F_RXCSUM;
netdev->hw_features |= NETIF_F_RXALL;
netdev->hw_features |= NETIF_F_RXFCS;
netdev->hw_features |= (NETIF_F_RXCSUM |
NETIF_F_RXALL |
NETIF_F_RXFCS);

if (pci_using_dac) {
netdev->features |= NETIF_F_HIGHDMA;
netdev->vlan_features |= NETIF_F_HIGHDMA;
}

netdev->vlan_features |= NETIF_F_TSO;
netdev->vlan_features |= NETIF_F_HW_CSUM;
netdev->vlan_features |= NETIF_F_SG;
netdev->vlan_features |= (NETIF_F_TSO |
NETIF_F_HW_CSUM |
NETIF_F_SG);

netdev->priv_flags |= IFF_UNICAST_FLT;

Expand Down
8 changes: 2 additions & 6 deletions trunk/drivers/net/team/team_mode_activebackup.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,8 @@ static void ab_port_leave(struct team *team, struct team_port *port)

static int ab_active_port_get(struct team *team, struct team_gsetter_ctx *ctx)
{
struct team_port *active_port;

active_port = rcu_dereference_protected(ab_priv(team)->active_port,
lockdep_is_held(&team->lock));
if (active_port)
ctx->data.u32_val = active_port->dev->ifindex;
if (ab_priv(team)->active_port)
ctx->data.u32_val = ab_priv(team)->active_port->dev->ifindex;
else
ctx->data.u32_val = 0;
return 0;
Expand Down
14 changes: 4 additions & 10 deletions trunk/drivers/net/team/team_mode_loadbalance.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ static void lb_tx_hash_to_port_mapping_null_port(struct team *team,
struct lb_port_mapping *pm;

pm = &lb_priv->ex->tx_hash_to_port_mapping[i];
if (rcu_access_pointer(pm->port) == port) {
RCU_INIT_POINTER(pm->port, NULL);
if (pm->port == port) {
rcu_assign_pointer(pm->port, NULL);
team_option_inst_set_change(pm->opt_inst_info);
changed = true;
}
Expand Down Expand Up @@ -274,7 +274,6 @@ static int lb_bpf_func_set(struct team *team, struct team_gsetter_ctx *ctx)
{
struct lb_priv *lb_priv = get_lb_priv(team);
struct sk_filter *fp = NULL;
struct sk_filter *orig_fp;
struct sock_fprog *fprog = NULL;
int err;

Expand All @@ -293,9 +292,7 @@ static int lb_bpf_func_set(struct team *team, struct team_gsetter_ctx *ctx)
if (lb_priv->ex->orig_fprog) {
/* Clear old filter data */
__fprog_destroy(lb_priv->ex->orig_fprog);
orig_fp = rcu_dereference_protected(lb_priv->fp,
lockdep_is_held(&team->lock));
sk_unattached_filter_destroy(orig_fp);
sk_unattached_filter_destroy(lb_priv->fp);
}

rcu_assign_pointer(lb_priv->fp, fp);
Expand All @@ -306,12 +303,9 @@ static int lb_bpf_func_set(struct team *team, struct team_gsetter_ctx *ctx)
static int lb_tx_method_get(struct team *team, struct team_gsetter_ctx *ctx)
{
struct lb_priv *lb_priv = get_lb_priv(team);
lb_select_tx_port_func_t *func;
char *name;

func = rcu_dereference_protected(lb_priv->select_tx_port_func,
lockdep_is_held(&team->lock));
name = lb_select_tx_port_get_name(func);
name = lb_select_tx_port_get_name(lb_priv->select_tx_port_func);
BUG_ON(!name);
ctx->data.str_val = name;
return 0;
Expand Down
34 changes: 19 additions & 15 deletions trunk/net/ipv4/inetpeer.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int inet_peer_maxttl __read_mostly = 10 * 60 * HZ; /* usual time to live: 10 min

static void inetpeer_gc_worker(struct work_struct *work)
{
struct inet_peer *p, *n, *c;
struct inet_peer *p, *n;
LIST_HEAD(list);

spin_lock_bh(&gc_lock);
Expand All @@ -138,19 +138,17 @@ static void inetpeer_gc_worker(struct work_struct *work)

list_for_each_entry_safe(p, n, &list, gc_list) {

if (need_resched())
if(need_resched())
cond_resched();

c = rcu_dereference_protected(p->avl_left, 1);
if (c != peer_avl_empty) {
list_add_tail(&c->gc_list, &list);
p->avl_left = peer_avl_empty_rcu;
if (p->avl_left != peer_avl_empty) {
list_add_tail(&p->avl_left->gc_list, &list);
p->avl_left = peer_avl_empty;
}

c = rcu_dereference_protected(p->avl_right, 1);
if (c != peer_avl_empty) {
list_add_tail(&c->gc_list, &list);
p->avl_right = peer_avl_empty_rcu;
if (p->avl_right != peer_avl_empty) {
list_add_tail(&p->avl_right->gc_list, &list);
p->avl_right = peer_avl_empty;
}

n = list_entry(p->gc_list.next, struct inet_peer, gc_list);
Expand Down Expand Up @@ -589,17 +587,23 @@ static void inetpeer_inval_rcu(struct rcu_head *head)

void inetpeer_invalidate_tree(struct inet_peer_base *base)
{
struct inet_peer *root;
struct inet_peer *old, *new, *prev;

write_seqlock_bh(&base->lock);

root = rcu_deref_locked(base->root, base);
if (root != peer_avl_empty) {
base->root = peer_avl_empty_rcu;
old = base->root;
if (old == peer_avl_empty_rcu)
goto out;

new = peer_avl_empty_rcu;

prev = cmpxchg(&base->root, old, new);
if (prev == old) {
base->total = 0;
call_rcu(&root->gc_rcu, inetpeer_inval_rcu);
call_rcu(&prev->gc_rcu, inetpeer_inval_rcu);
}

out:
write_sequnlock_bh(&base->lock);
}
EXPORT_SYMBOL(inetpeer_invalidate_tree);

0 comments on commit 76ebb14

Please sign in to comment.