~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to net/phonet/pn_dev.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
        return err;
163
163
}
164
164
 
165
 
static void phonet_device_rcu_free(struct rcu_head *head)
166
 
{
167
 
        struct phonet_device *pnd;
168
 
 
169
 
        pnd = container_of(head, struct phonet_device, rcu);
170
 
        kfree(pnd);
171
 
}
172
 
 
173
165
int phonet_address_del(struct net_device *dev, u8 addr)
174
166
{
175
167
        struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
188
180
        mutex_unlock(&pndevs->lock);
189
181
 
190
182
        if (pnd)
191
 
                call_rcu(&pnd->rcu, phonet_device_rcu_free);
 
183
                kfree_rcu(pnd, rcu);
192
184
 
193
185
        return err;
194
186
}
426
418
        return 0;
427
419
}
428
420
 
429
 
struct net_device *phonet_route_get(struct net *net, u8 daddr)
 
421
struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr)
430
422
{
431
423
        struct phonet_net *pnn = phonet_pernet(net);
432
424
        struct phonet_routes *routes = &pnn->routes;
433
425
        struct net_device *dev;
434
426
 
435
 
        ASSERT_RTNL(); /* no need to hold the device */
436
 
 
437
427
        daddr >>= 2;
438
 
        rcu_read_lock();
439
428
        dev = rcu_dereference(routes->table[daddr]);
440
 
        rcu_read_unlock();
441
429
        return dev;
442
430
}
443
431