* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <asm/atomic.h>
-
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sched.h>
+#include <asm/atomic.h>
+
#include "w1.h"
#include "w1_io.h"
#include "w1_log.h"
static pid_t control_thread;
static int control_needs_exit;
static DECLARE_COMPLETION(w1_control_complete);
-static DECLARE_WAIT_QUEUE_HEAD(w1_control_wait);
static int w1_master_match(struct device *dev, struct device_driver *drv)
{
return sprintf(buf, "No family registered.\n");
}
-struct bus_type w1_bus_type = {
+static struct bus_type w1_bus_type = {
.name = "w1",
.match = w1_master_match,
};
.show = &w1_default_read_name,
};
-ssize_t w1_master_attribute_show_name(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_name(struct device *dev, char *buf)
{
struct w1_master *md = container_of (dev, struct w1_master, dev);
ssize_t count;
return count;
}
-ssize_t w1_master_attribute_show_pointer(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_pointer(struct device *dev, char *buf)
{
struct w1_master *md = container_of(dev, struct w1_master, dev);
ssize_t count;
return count;
}
-ssize_t w1_master_attribute_show_timeout(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_timeout(struct device *dev, char *buf)
{
ssize_t count;
count = sprintf(buf, "%d\n", w1_timeout);
return count;
}
-ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, char *buf)
{
struct w1_master *md = container_of(dev, struct w1_master, dev);
ssize_t count;
return count;
}
-ssize_t w1_master_attribute_show_attempts(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_attempts(struct device *dev, char *buf)
{
struct w1_master *md = container_of(dev, struct w1_master, dev);
ssize_t count;
return count;
}
-ssize_t w1_master_attribute_show_slave_count(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_slave_count(struct device *dev, char *buf)
{
struct w1_master *md = container_of(dev, struct w1_master, dev);
ssize_t count;
return count;
}
-ssize_t w1_master_attribute_show_slaves(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_slaves(struct device *dev, char *buf)
{
struct w1_master *md = container_of(dev, struct w1_master, dev);
if (!f) {
spin_unlock(&w1_flock);
dev_info(&dev->dev, "Family %x for %02x.%012llx.%02x is not registered.\n",
- rn->family, rn->family, rn->id, rn->crc);
+ rn->family, rn->family,
+ (unsigned long long)rn->id, rn->crc);
kfree(sl);
return -ENODEV;
}
slave_count++;
}
+ rn = cpu_to_le64(rn);
+
if (slave_count == dev->slave_count &&
- rn && ((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn, 7)) {
- w1_attach_slave_device(dev, (struct w1_reg_num *) &rn);
+ rn && ((le64_to_cpu(rn) >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn, 7)) {
+ w1_attach_slave_device(dev, tmp);
}
atomic_dec(&dev->refcnt);
struct w1_slave *sl;
struct w1_master *dev;
struct list_head *ent, *ment, *n, *mn;
- int err, have_to_wait = 0, timeout;
+ int err, have_to_wait = 0;
daemonize("w1_control");
allow_signal(SIGTERM);
while (!control_needs_exit || have_to_wait) {
have_to_wait = 0;
- timeout = w1_timeout*HZ;
- do {
- timeout = interruptible_sleep_on_timeout(&w1_control_wait, timeout);
- try_to_freeze(PF_FREEZE);
- } while (!signal_pending(current) && (timeout > 0));
+ try_to_freeze(PF_FREEZE);
+ msleep_interruptible(w1_timeout * 1000);
if (signal_pending(current))
flush_signals(current);
int w1_process(void *data)
{
struct w1_master *dev = (struct w1_master *) data;
- unsigned long timeout;
struct list_head *ent, *n;
struct w1_slave *sl;
allow_signal(SIGTERM);
while (!dev->need_exit) {
- timeout = w1_timeout*HZ;
- do {
- timeout = interruptible_sleep_on_timeout(&dev->kwait, timeout);
- try_to_freeze(PF_FREEZE);
- } while (!signal_pending(current) && (timeout > 0));
+ try_to_freeze(PF_FREEZE);
+ msleep_interruptible(w1_timeout * 1000);
if (signal_pending(current))
flush_signals(current);
module_init(w1_init);
module_exit(w1_fini);
-
-EXPORT_SYMBOL(w1_create_master_attributes);
-EXPORT_SYMBOL(w1_destroy_master_attributes);