Commit b9dcde6e authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/gregkh/linux/w1-2.6

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents a9938579 3de7cc99
...@@ -45,9 +45,6 @@ int ds_set_speed(struct ds_device *, int); ...@@ -45,9 +45,6 @@ int ds_set_speed(struct ds_device *, int);
int ds_reset(struct ds_device *, struct ds_status *); int ds_reset(struct ds_device *, struct ds_status *);
int ds_detect(struct ds_device *, struct ds_status *); int ds_detect(struct ds_device *, struct ds_status *);
int ds_stop_pulse(struct ds_device *, int); int ds_stop_pulse(struct ds_device *, int);
int ds_send_data(struct ds_device *, unsigned char *, int);
int ds_recv_data(struct ds_device *, unsigned char *, int);
int ds_recv_status(struct ds_device *, struct ds_status *);
struct ds_device * ds_get_device(void); struct ds_device * ds_get_device(void);
void ds_put_device(struct ds_device *); void ds_put_device(struct ds_device *);
...@@ -148,7 +145,7 @@ int ds_recv_status_nodump(struct ds_device *dev, struct ds_status *st, unsigned ...@@ -148,7 +145,7 @@ int ds_recv_status_nodump(struct ds_device *dev, struct ds_status *st, unsigned
return count; return count;
} }
int ds_recv_status(struct ds_device *dev, struct ds_status *st) static int ds_recv_status(struct ds_device *dev, struct ds_status *st)
{ {
unsigned char buf[64]; unsigned char buf[64];
int count, err = 0, i; int count, err = 0, i;
...@@ -206,7 +203,7 @@ int ds_recv_status(struct ds_device *dev, struct ds_status *st) ...@@ -206,7 +203,7 @@ int ds_recv_status(struct ds_device *dev, struct ds_status *st)
return err; return err;
} }
int ds_recv_data(struct ds_device *dev, unsigned char *buf, int size) static int ds_recv_data(struct ds_device *dev, unsigned char *buf, int size)
{ {
int count, err; int count, err;
struct ds_status st; struct ds_status st;
...@@ -234,7 +231,7 @@ int ds_recv_data(struct ds_device *dev, unsigned char *buf, int size) ...@@ -234,7 +231,7 @@ int ds_recv_data(struct ds_device *dev, unsigned char *buf, int size)
return count; return count;
} }
int ds_send_data(struct ds_device *dev, unsigned char *buf, int len) static int ds_send_data(struct ds_device *dev, unsigned char *buf, int len)
{ {
int count, err; int count, err;
...@@ -774,15 +771,19 @@ EXPORT_SYMBOL(ds_read_block); ...@@ -774,15 +771,19 @@ EXPORT_SYMBOL(ds_read_block);
EXPORT_SYMBOL(ds_write_byte); EXPORT_SYMBOL(ds_write_byte);
EXPORT_SYMBOL(ds_write_bit); EXPORT_SYMBOL(ds_write_bit);
EXPORT_SYMBOL(ds_write_block); EXPORT_SYMBOL(ds_write_block);
EXPORT_SYMBOL(ds_reset);
EXPORT_SYMBOL(ds_get_device);
EXPORT_SYMBOL(ds_put_device);
/*
* This functions can be used for EEPROM programming,
* when driver will be included into mainline this will
* require uncommenting.
*/
#if 0
EXPORT_SYMBOL(ds_start_pulse); EXPORT_SYMBOL(ds_start_pulse);
EXPORT_SYMBOL(ds_set_speed); EXPORT_SYMBOL(ds_set_speed);
EXPORT_SYMBOL(ds_reset);
EXPORT_SYMBOL(ds_detect); EXPORT_SYMBOL(ds_detect);
EXPORT_SYMBOL(ds_stop_pulse); EXPORT_SYMBOL(ds_stop_pulse);
EXPORT_SYMBOL(ds_send_data);
EXPORT_SYMBOL(ds_recv_data);
EXPORT_SYMBOL(ds_recv_status);
EXPORT_SYMBOL(ds_search); EXPORT_SYMBOL(ds_search);
EXPORT_SYMBOL(ds_get_device); #endif
EXPORT_SYMBOL(ds_put_device);
...@@ -161,9 +161,6 @@ int ds_set_speed(struct ds_device *, int); ...@@ -161,9 +161,6 @@ int ds_set_speed(struct ds_device *, int);
int ds_reset(struct ds_device *, struct ds_status *); int ds_reset(struct ds_device *, struct ds_status *);
int ds_detect(struct ds_device *, struct ds_status *); int ds_detect(struct ds_device *, struct ds_status *);
int ds_stop_pulse(struct ds_device *, int); int ds_stop_pulse(struct ds_device *, int);
int ds_send_data(struct ds_device *, unsigned char *, int);
int ds_recv_data(struct ds_device *, unsigned char *, int);
int ds_recv_status(struct ds_device *, struct ds_status *);
struct ds_device * ds_get_device(void); struct ds_device * ds_get_device(void);
void ds_put_device(struct ds_device *); void ds_put_device(struct ds_device *);
int ds_write_block(struct ds_device *, u8 *, int); int ds_write_block(struct ds_device *, u8 *, int);
......
...@@ -235,7 +235,7 @@ static void __devexit matrox_w1_remove(struct pci_dev *pdev) ...@@ -235,7 +235,7 @@ static void __devexit matrox_w1_remove(struct pci_dev *pdev)
static int __init matrox_w1_init(void) static int __init matrox_w1_init(void)
{ {
return pci_module_init(&matrox_w1_pci_driver); return pci_register_driver(&matrox_w1_pci_driver);
} }
static void __exit matrox_w1_fini(void) static void __exit matrox_w1_fini(void)
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <asm/atomic.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -33,6 +31,8 @@ ...@@ -33,6 +31,8 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <asm/atomic.h>
#include "w1.h" #include "w1.h"
#include "w1_io.h" #include "w1_io.h"
#include "w1_log.h" #include "w1_log.h"
...@@ -58,7 +58,6 @@ LIST_HEAD(w1_masters); ...@@ -58,7 +58,6 @@ LIST_HEAD(w1_masters);
static pid_t control_thread; static pid_t control_thread;
static int control_needs_exit; static int control_needs_exit;
static DECLARE_COMPLETION(w1_control_complete); 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) static int w1_master_match(struct device *dev, struct device_driver *drv)
{ {
...@@ -100,7 +99,7 @@ static ssize_t w1_default_read_bin(struct kobject *kobj, char *buf, loff_t off, ...@@ -100,7 +99,7 @@ static ssize_t w1_default_read_bin(struct kobject *kobj, char *buf, loff_t off,
return sprintf(buf, "No family registered.\n"); return sprintf(buf, "No family registered.\n");
} }
struct bus_type w1_bus_type = { static struct bus_type w1_bus_type = {
.name = "w1", .name = "w1",
.match = w1_master_match, .match = w1_master_match,
}; };
...@@ -138,7 +137,7 @@ static struct device_attribute w1_slave_attribute_val = { ...@@ -138,7 +137,7 @@ static struct device_attribute w1_slave_attribute_val = {
.show = &w1_default_read_name, .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); struct w1_master *md = container_of (dev, struct w1_master, dev);
ssize_t count; ssize_t count;
...@@ -153,7 +152,7 @@ ssize_t w1_master_attribute_show_name(struct device *dev, char *buf) ...@@ -153,7 +152,7 @@ ssize_t w1_master_attribute_show_name(struct device *dev, char *buf)
return 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); struct w1_master *md = container_of(dev, struct w1_master, dev);
ssize_t count; ssize_t count;
...@@ -167,14 +166,14 @@ ssize_t w1_master_attribute_show_pointer(struct device *dev, char *buf) ...@@ -167,14 +166,14 @@ ssize_t w1_master_attribute_show_pointer(struct device *dev, char *buf)
return 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; ssize_t count;
count = sprintf(buf, "%d\n", w1_timeout); count = sprintf(buf, "%d\n", w1_timeout);
return count; 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); struct w1_master *md = container_of(dev, struct w1_master, dev);
ssize_t count; ssize_t count;
...@@ -188,7 +187,7 @@ ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, char *buf) ...@@ -188,7 +187,7 @@ ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, char *buf)
return 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); struct w1_master *md = container_of(dev, struct w1_master, dev);
ssize_t count; ssize_t count;
...@@ -202,7 +201,7 @@ ssize_t w1_master_attribute_show_attempts(struct device *dev, char *buf) ...@@ -202,7 +201,7 @@ ssize_t w1_master_attribute_show_attempts(struct device *dev, char *buf)
return 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); struct w1_master *md = container_of(dev, struct w1_master, dev);
ssize_t count; ssize_t count;
...@@ -216,7 +215,7 @@ ssize_t w1_master_attribute_show_slave_count(struct device *dev, char *buf) ...@@ -216,7 +215,7 @@ ssize_t w1_master_attribute_show_slave_count(struct device *dev, char *buf)
return 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); struct w1_master *md = container_of(dev, struct w1_master, dev);
...@@ -649,7 +648,7 @@ int w1_control(void *data) ...@@ -649,7 +648,7 @@ int w1_control(void *data)
struct w1_slave *sl; struct w1_slave *sl;
struct w1_master *dev; struct w1_master *dev;
struct list_head *ent, *ment, *n, *mn; struct list_head *ent, *ment, *n, *mn;
int err, have_to_wait = 0, timeout; int err, have_to_wait = 0;
daemonize("w1_control"); daemonize("w1_control");
allow_signal(SIGTERM); allow_signal(SIGTERM);
...@@ -657,11 +656,8 @@ int w1_control(void *data) ...@@ -657,11 +656,8 @@ int w1_control(void *data)
while (!control_needs_exit || have_to_wait) { while (!control_needs_exit || have_to_wait) {
have_to_wait = 0; have_to_wait = 0;
timeout = w1_timeout*HZ;
do {
timeout = interruptible_sleep_on_timeout(&w1_control_wait, timeout);
try_to_freeze(PF_FREEZE); try_to_freeze(PF_FREEZE);
} while (!signal_pending(current) && (timeout > 0)); msleep_interruptible(w1_timeout * 1000);
if (signal_pending(current)) if (signal_pending(current))
flush_signals(current); flush_signals(current);
...@@ -721,7 +717,6 @@ int w1_control(void *data) ...@@ -721,7 +717,6 @@ int w1_control(void *data)
int w1_process(void *data) int w1_process(void *data)
{ {
struct w1_master *dev = (struct w1_master *) data; struct w1_master *dev = (struct w1_master *) data;
unsigned long timeout;
struct list_head *ent, *n; struct list_head *ent, *n;
struct w1_slave *sl; struct w1_slave *sl;
...@@ -729,11 +724,8 @@ int w1_process(void *data) ...@@ -729,11 +724,8 @@ int w1_process(void *data)
allow_signal(SIGTERM); allow_signal(SIGTERM);
while (!dev->need_exit) { while (!dev->need_exit) {
timeout = w1_timeout*HZ;
do {
timeout = interruptible_sleep_on_timeout(&dev->kwait, timeout);
try_to_freeze(PF_FREEZE); try_to_freeze(PF_FREEZE);
} while (!signal_pending(current) && (timeout > 0)); msleep_interruptible(w1_timeout * 1000);
if (signal_pending(current)) if (signal_pending(current))
flush_signals(current); flush_signals(current);
...@@ -839,6 +831,3 @@ void w1_fini(void) ...@@ -839,6 +831,3 @@ void w1_fini(void)
module_init(w1_init); module_init(w1_init);
module_exit(w1_fini); module_exit(w1_fini);
EXPORT_SYMBOL(w1_create_master_attributes);
EXPORT_SYMBOL(w1_destroy_master_attributes);
...@@ -115,7 +115,6 @@ struct w1_master ...@@ -115,7 +115,6 @@ struct w1_master
int need_exit; int need_exit;
pid_t kpid; pid_t kpid;
wait_queue_head_t kwait;
struct semaphore mutex; struct semaphore mutex;
struct device_driver *driver; struct device_driver *driver;
......
...@@ -138,13 +138,13 @@ void w1_family_get(struct w1_family *f) ...@@ -138,13 +138,13 @@ void w1_family_get(struct w1_family *f)
void __w1_family_get(struct w1_family *f) void __w1_family_get(struct w1_family *f)
{ {
smp_mb__before_atomic_inc();
atomic_inc(&f->refcnt); atomic_inc(&f->refcnt);
smp_mb__after_atomic_inc();
} }
EXPORT_SYMBOL(w1_family_get); EXPORT_SYMBOL(w1_family_get);
EXPORT_SYMBOL(w1_family_put); EXPORT_SYMBOL(w1_family_put);
EXPORT_SYMBOL(__w1_family_get);
EXPORT_SYMBOL(__w1_family_put);
EXPORT_SYMBOL(w1_family_registered); EXPORT_SYMBOL(w1_family_registered);
EXPORT_SYMBOL(w1_unregister_family); EXPORT_SYMBOL(w1_unregister_family);
EXPORT_SYMBOL(w1_register_family); EXPORT_SYMBOL(w1_register_family);
...@@ -74,7 +74,6 @@ struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, ...@@ -74,7 +74,6 @@ struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
INIT_LIST_HEAD(&dev->slist); INIT_LIST_HEAD(&dev->slist);
init_MUTEX(&dev->mutex); init_MUTEX(&dev->mutex);
init_waitqueue_head(&dev->kwait);
init_completion(&dev->dev_released); init_completion(&dev->dev_released);
init_completion(&dev->dev_exited); init_completion(&dev->dev_exited);
...@@ -217,8 +216,5 @@ void w1_remove_master_device(struct w1_bus_master *bm) ...@@ -217,8 +216,5 @@ void w1_remove_master_device(struct w1_bus_master *bm)
__w1_remove_master_device(dev); __w1_remove_master_device(dev);
} }
EXPORT_SYMBOL(w1_alloc_dev);
EXPORT_SYMBOL(w1_free_dev);
EXPORT_SYMBOL(w1_add_master_device); EXPORT_SYMBOL(w1_add_master_device);
EXPORT_SYMBOL(w1_remove_master_device); EXPORT_SYMBOL(w1_remove_master_device);
EXPORT_SYMBOL(__w1_remove_master_device);
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/delay.h>
#include "w1.h" #include "w1.h"
#include "w1_io.h" #include "w1_io.h"
...@@ -103,6 +104,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si ...@@ -103,6 +104,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si
int i, max_trying = 10; int i, max_trying = 10;
atomic_inc(&sl->refcnt); atomic_inc(&sl->refcnt);
smp_mb__after_atomic_inc();
if (down_interruptible(&sl->master->mutex)) { if (down_interruptible(&sl->master->mutex)) {
count = 0; count = 0;
goto out_dec; goto out_dec;
...@@ -128,7 +130,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si ...@@ -128,7 +130,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si
if (!w1_reset_bus (dev)) { if (!w1_reset_bus (dev)) {
int count = 0; int count = 0;
u8 match[9] = {W1_MATCH_ROM, }; u8 match[9] = {W1_MATCH_ROM, };
unsigned long tm; unsigned int tm = 750;
memcpy(&match[1], (u64 *) & sl->reg_num, 8); memcpy(&match[1], (u64 *) & sl->reg_num, 8);
...@@ -136,11 +138,8 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si ...@@ -136,11 +138,8 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si
w1_write_8(dev, W1_CONVERT_TEMP); w1_write_8(dev, W1_CONVERT_TEMP);
tm = jiffies + msecs_to_jiffies(750); while (tm) {
while(time_before(jiffies, tm)) { tm = msleep_interruptible(tm);
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(tm-jiffies);
if (signal_pending(current)) if (signal_pending(current))
flush_signals(current); flush_signals(current);
} }
...@@ -181,6 +180,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si ...@@ -181,6 +180,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si
out: out:
up(&dev->mutex); up(&dev->mutex);
out_dec: out_dec:
smp_mb__before_atomic_inc();
atomic_dec(&sl->refcnt); atomic_dec(&sl->refcnt);
return count; return count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment