]> err.no Git - linux-2.6/blobdiff - drivers/w1/w1.h
[PATCH] w1_ds2433: Added crc16 protection and read caching.
[linux-2.6] / drivers / w1 / w1.h
index 3cfdd08d32fcf4c9d7b7e12714aaf9559d4c2dd5..d8900780c3bf1fbcfbf1933a3d42b1267c1b02e0 100644 (file)
@@ -75,11 +75,9 @@ struct w1_slave
 
        struct w1_master        *master;
        struct w1_family        *family;
+       void                    *family_data;
        struct device           dev;
-       struct completion       dev_released;
-
-       struct bin_attribute    attr_bin;
-       struct device_attribute attr_name;
+       struct completion       released;
 };
 
 typedef void (* w1_slave_found_callback)(unsigned long, u64);
@@ -151,6 +149,9 @@ struct w1_bus_master
        void            (*search)(unsigned long, w1_slave_found_callback);
 };
 
+#define W1_MASTER_NEED_EXIT            0
+#define W1_MASTER_NEED_RECONNECT       1
+
 struct w1_master
 {
        struct list_head        w1_master_entry;
@@ -162,19 +163,20 @@ struct w1_master
        int                     slave_ttl;
        int                     initialized;
        u32                     id;
+       int                     search_count;
 
        atomic_t                refcnt;
 
        void                    *priv;
        int                     priv_size;
 
-       int                     need_exit;
+       long                    flags;
+
        pid_t                   kpid;
        struct semaphore        mutex;
 
        struct device_driver    *driver;
        struct device           dev;
-       struct completion       dev_released;
        struct completion       dev_exited;
 
        struct w1_bus_master    *bus_master;
@@ -186,6 +188,21 @@ struct w1_master
 int w1_create_master_attributes(struct w1_master *);
 void w1_search(struct w1_master *dev, w1_slave_found_callback cb);
 
+static inline struct w1_slave* dev_to_w1_slave(struct device *dev)
+{
+       return container_of(dev, struct w1_slave, dev);
+}
+
+static inline struct w1_slave* kobj_to_w1_slave(struct kobject *kobj)
+{
+       return dev_to_w1_slave(container_of(kobj, struct device, kobj));
+}
+
+static inline struct w1_master* dev_to_w1_master(struct device *dev)
+{
+       return container_of(dev, struct w1_master, dev);
+}
+
 #endif /* __KERNEL__ */
 
 #endif /* __W1_H */