[PATCH] w1: cleanups.
- white space changes. - list_for_each_entry/list_for_each_entry_safe and reverse changes. - small coding style changes. - removed redundant NULL checks. - use attribute group and macros instead of direct device attributes. Patch is havily based on work from Adrian Bunk and Dmitry Torokhov, thanks guys. Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
85e941cc9f
commit
7785925dd8
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* w1_int.c
|
||||
* w1_int.c
|
||||
*
|
||||
* Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
|
||||
*
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -39,8 +39,9 @@ extern spinlock_t w1_mlock;
|
||||
|
||||
extern int w1_process(void *);
|
||||
|
||||
struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
|
||||
struct device_driver *driver, struct device *device)
|
||||
static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
|
||||
struct device_driver *driver,
|
||||
struct device *device)
|
||||
{
|
||||
struct w1_master *dev;
|
||||
int err;
|
||||
@@ -60,13 +61,13 @@ struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
|
||||
|
||||
dev->bus_master = (struct w1_bus_master *)(dev + 1);
|
||||
|
||||
dev->owner = THIS_MODULE;
|
||||
dev->max_slave_count = slave_count;
|
||||
dev->slave_count = 0;
|
||||
dev->attempts = 0;
|
||||
dev->kpid = -1;
|
||||
dev->initialized = 0;
|
||||
dev->id = id;
|
||||
dev->owner = THIS_MODULE;
|
||||
dev->max_slave_count = slave_count;
|
||||
dev->slave_count = 0;
|
||||
dev->attempts = 0;
|
||||
dev->kpid = -1;
|
||||
dev->initialized = 0;
|
||||
dev->id = id;
|
||||
dev->slave_ttl = slave_ttl;
|
||||
|
||||
atomic_set(&dev->refcnt, 2);
|
||||
@@ -105,7 +106,7 @@ struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
|
||||
return dev;
|
||||
}
|
||||
|
||||
void w1_free_dev(struct w1_master *dev)
|
||||
static void w1_free_dev(struct w1_master *dev)
|
||||
{
|
||||
device_unregister(&dev->dev);
|
||||
if (dev->nls && dev->nls->sk_socket)
|
||||
@@ -197,10 +198,8 @@ void __w1_remove_master_device(struct w1_master *dev)
|
||||
void w1_remove_master_device(struct w1_bus_master *bm)
|
||||
{
|
||||
struct w1_master *dev = NULL;
|
||||
struct list_head *ent, *n;
|
||||
|
||||
list_for_each_safe(ent, n, &w1_masters) {
|
||||
dev = list_entry(ent, struct w1_master, w1_master_entry);
|
||||
list_for_each_entry(dev, &w1_masters, w1_master_entry) {
|
||||
if (!dev->initialized)
|
||||
continue;
|
||||
|
||||
|
Reference in New Issue
Block a user