[PATCH] w1: Cleans up usage of touch_bit/w1_read_bit/w1_write_bit.
[safe/jmp/linux-2.6] / drivers / w1 / w1_int.c
index ce24e3b..280f140 100644 (file)
@@ -121,6 +121,14 @@ int w1_add_master_device(struct w1_bus_master *master)
        int retval = 0;
        struct w1_netlink_msg msg;
 
+        /* validate minimum functionality */
+        if (!(master->touch_bit && master->reset_bus) &&
+            !(master->write_bit && master->read_bit))
+        {
+           printk(KERN_ERR "w1_add_master_device: invalid function set\n");
+           return(-EINVAL);
+        }
+
        dev = w1_alloc_dev(w1_ids++, w1_max_slave_count, w1_max_slave_ttl, &w1_driver, &w1_device);
        if (!dev)
                return -ENOMEM;