struct geoip_country_kernel {
struct list_head list;
struct geoip_subnet *subnets;
+ atomic_t ref;
u_int32_t count;
- u_int32_t ref;
u_int16_t cc;
};
spin_lock_bh(&geoip_lock);
p->subnets = s;
- p->ref = 1;
+ atomic_set(&p->ref, 1);
INIT_LIST_HEAD(&p->list);
list_add_tail(&p->list, &geoip_head);
static void geoip_try_remove_node(struct geoip_country_kernel *p)
{
spin_lock_bh(&geoip_lock);
- if (!atomic_dec_and_test((atomic_t *)&p->ref)) {
+ if (!atomic_dec_and_test(&p->ref)) {
spin_unlock_bh(&geoip_lock);
return;
}
list_for_each_entry(p, &geoip_head, list)
if (p->cc == cc) {
- atomic_inc((atomic_t *)&p->ref);
+ atomic_inc(&p->ref);
spin_unlock_bh(&geoip_lock);
return p;
}