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);
int ds_reset(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_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);
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
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];
int count, err = 0, i;
......@@ -206,7 +203,7 @@ int ds_recv_status(struct ds_device *dev, struct ds_status *st)
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;
struct ds_status st;
......@@ -234,7 +231,7 @@ int ds_recv_data(struct ds_device *dev, unsigned char *buf, int size)
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;
......@@ -774,15 +771,19 @@ EXPORT_SYMBOL(ds_read_block);
EXPORT_SYMBOL(ds_write_byte);
EXPORT_SYMBOL(ds_write_bit);
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_set_speed);
EXPORT_SYMBOL(ds_reset);
EXPORT_SYMBOL(ds_detect);
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_get_device);
EXPORT_SYMBOL(ds_put_device);
#endif
......@@ -161,9 +161,6 @@ int ds_set_speed(struct ds_device *, int);
int ds_reset(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_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);
void ds_put_device(struct ds_device *);
int ds_write_block(struct ds_device *, u8 *, int);
......
......@@ -235,7 +235,7 @@ static void __devexit matrox_w1_remove(struct pci_dev *pdev)
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)
......
......@@ -19,8 +19,6 @@
* 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>
......@@ -33,6 +31,8 @@
#include <linux/slab.h>
#include <linux/sched.h>
#include <asm/atomic.h>
#include "w1.h"
#include "w1_io.h"
#include "w1_log.h"
......@@ -58,7 +58,6 @@ LIST_HEAD(w1_masters);
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)
{
......@@ -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");
}
struct bus_type w1_bus_type = {
static struct bus_type w1_bus_type = {
.name = "w1",
.match = w1_master_match,
};
......@@ -138,7 +137,7 @@ static struct device_attribute w1_slave_attribute_val = {
.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;
......@@ -153,7 +152,7 @@ ssize_t w1_master_attribute_show_name(struct device *dev, char *buf)
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;
......@@ -167,14 +166,14 @@ ssize_t w1_master_attribute_show_pointer(struct device *dev, char *buf)
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;
......@@ -188,7 +187,7 @@ ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, char *buf)
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;
......@@ -202,7 +201,7 @@ ssize_t w1_master_attribute_show_attempts(struct device *dev, char *buf)
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;
......@@ -216,7 +215,7 @@ ssize_t w1_master_attribute_show_slave_count(struct device *dev, char *buf)
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);
......@@ -649,7 +648,7 @@ int w1_control(void *data)
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);
......@@ -657,11 +656,8 @@ int w1_control(void *data)
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));
msleep_interruptible(w1_timeout * 1000);
if (signal_pending(current))
flush_signals(current);
......@@ -721,7 +717,6 @@ int w1_control(void *data)
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;
......@@ -729,11 +724,8 @@ int w1_process(void *data)
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));
msleep_interruptible(w1_timeout * 1000);
if (signal_pending(current))
flush_signals(current);
......@@ -839,6 +831,3 @@ void w1_fini(void)
module_init(w1_init);
module_exit(w1_fini);
EXPORT_SYMBOL(w1_create_master_attributes);
EXPORT_SYMBOL(w1_destroy_master_attributes);
......@@ -115,7 +115,6 @@ struct w1_master
int need_exit;
pid_t kpid;
wait_queue_head_t kwait;
struct semaphore mutex;
struct device_driver *driver;
......
......@@ -138,13 +138,13 @@ 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);
smp_mb__after_atomic_inc();
}
EXPORT_SYMBOL(w1_family_get);
EXPORT_SYMBOL(w1_family_put);
EXPORT_SYMBOL(__w1_family_get);
EXPORT_SYMBOL(__w1_family_put);
EXPORT_SYMBOL(w1_family_registered);
EXPORT_SYMBOL(w1_unregister_family);
EXPORT_SYMBOL(w1_register_family);
......@@ -74,7 +74,6 @@ struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
INIT_LIST_HEAD(&dev->slist);
init_MUTEX(&dev->mutex);
init_waitqueue_head(&dev->kwait);
init_completion(&dev->dev_released);
init_completion(&dev->dev_exited);
......@@ -217,8 +216,5 @@ void w1_remove_master_device(struct w1_bus_master *bm)
__w1_remove_master_device(dev);
}
EXPORT_SYMBOL(w1_alloc_dev);
EXPORT_SYMBOL(w1_free_dev);
EXPORT_SYMBOL(w1_add_master_device);
EXPORT_SYMBOL(w1_remove_master_device);
EXPORT_SYMBOL(__w1_remove_master_device);
......@@ -26,6 +26,7 @@
#include <linux/moduleparam.h>
#include <linux/device.h>
#include <linux/types.h>
#include <linux/delay.h>
#include "w1.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
int i, max_trying = 10;
atomic_inc(&sl->refcnt);
smp_mb__after_atomic_inc();
if (down_interruptible(&sl->master->mutex)) {
count = 0;
goto out_dec;
......@@ -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)) {
int count = 0;
u8 match[9] = {W1_MATCH_ROM, };
unsigned long tm;
unsigned int tm = 750;
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
w1_write_8(dev, W1_CONVERT_TEMP);
tm = jiffies + msecs_to_jiffies(750);
while(time_before(jiffies, tm)) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(tm-jiffies);
while (tm) {
tm = msleep_interruptible(tm);
if (signal_pending(current))
flush_signals(current);
}
......@@ -181,6 +180,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si
out:
up(&dev->mutex);
out_dec:
smp_mb__before_atomic_inc();
atomic_dec(&sl->refcnt);
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