Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

w1: Add subsystem kernel public interface

Like other subsystems we should be able to define slave devices outside
of the w1 directory. To do this we move public facing interface
definitions to include/linux/w1.h and rename the internal definition
file to w1_internal.h.

As w1_family.h and w1_int.h contained almost entirely public
driver interface definitions we simply removed these files and
moved the remaining definitions into w1_internal.h.

With this we can now start to move slave devices out of w1/slaves and
into the subsystem based on the function they implement, again like
other drivers.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andrew F. Davis and committed by
Greg Kroah-Hartman
de0d6dbd acb7e8f7

+208 -260
+1
MAINTAINERS
··· 13790 13790 S: Maintained 13791 13791 F: Documentation/w1/ 13792 13792 F: drivers/w1/ 13793 + F: include/linux/w1.h 13793 13794 13794 13795 W83791D HARDWARE MONITORING DRIVER 13795 13796 M: Marc Hulsman <m.hulsman@tudelft.nl>
+1 -1
drivers/power/supply/ds2760_battery.c
··· 28 28 #include <linux/platform_device.h> 29 29 #include <linux/power_supply.h> 30 30 31 - #include "../../w1/w1.h" 31 + #include <linux/w1.h> 32 32 #include "../../w1/slaves/w1_ds2760.h" 33 33 34 34 struct ds2760_device_info {
+1 -1
drivers/power/supply/ds2780_battery.c
··· 21 21 #include <linux/power_supply.h> 22 22 #include <linux/idr.h> 23 23 24 - #include "../../w1/w1.h" 24 + #include <linux/w1.h> 25 25 #include "../../w1/slaves/w1_ds2780.h" 26 26 27 27 /* Current unit measurement in uA for a 1 milli-ohm sense resistor */
+1 -1
drivers/power/supply/ds2781_battery.c
··· 19 19 #include <linux/power_supply.h> 20 20 #include <linux/idr.h> 21 21 22 - #include "../../w1/w1.h" 22 + #include <linux/w1.h> 23 23 #include "../../w1/slaves/w1_ds2781.h" 24 24 25 25 /* Current unit measurement in uA for a 1 milli-ohm sense resistor */
+1 -2
drivers/w1/masters/ds1wm.c
··· 25 25 26 26 #include <asm/io.h> 27 27 28 - #include "../w1.h" 29 - #include "../w1_int.h" 28 + #include <linux/w1.h> 30 29 31 30 32 31 #define DS1WM_CMD 0x00 /* R/W 4 bits command */
+1 -2
drivers/w1/masters/ds2482.c
··· 20 20 #include <linux/delay.h> 21 21 #include <asm/delay.h> 22 22 23 - #include "../w1.h" 24 - #include "../w1_int.h" 23 + #include <linux/w1.h> 25 24 26 25 /** 27 26 * Allow the active pullup to be disabled, default is enabled.
+1 -2
drivers/w1/masters/ds2490.c
··· 25 25 #include <linux/usb.h> 26 26 #include <linux/slab.h> 27 27 28 - #include "../w1_int.h" 29 - #include "../w1.h" 28 + #include <linux/w1.h> 30 29 31 30 /* USB Standard */ 32 31 /* USB Control request vendor type */
+1 -2
drivers/w1/masters/matrox_w1.c
··· 34 34 #include <linux/pci_ids.h> 35 35 #include <linux/pci.h> 36 36 37 - #include "../w1.h" 38 - #include "../w1_int.h" 37 + #include <linux/w1.h> 39 38 40 39 /* 41 40 * Matrox G400 DDC registers.
+1 -2
drivers/w1/masters/mxc_w1.c
··· 19 19 #include <linux/module.h> 20 20 #include <linux/platform_device.h> 21 21 22 - #include "../w1.h" 23 - #include "../w1_int.h" 22 + #include <linux/w1.h> 24 23 25 24 /* 26 25 * MXC W1 Register offsets
+1 -2
drivers/w1/masters/omap_hdq.c
··· 19 19 #include <linux/pm_runtime.h> 20 20 #include <linux/of.h> 21 21 22 - #include "../w1.h" 23 - #include "../w1_int.h" 22 + #include <linux/w1.h> 24 23 25 24 #define MOD_NAME "OMAP_HDQ:" 26 25
+1 -2
drivers/w1/masters/w1-gpio.c
··· 20 20 #include <linux/of.h> 21 21 #include <linux/delay.h> 22 22 23 - #include "../w1.h" 24 - #include "../w1_int.h" 23 + #include <linux/w1.h> 25 24 26 25 static u8 w1_gpio_set_pullup(void *data, int delay) 27 26 {
+3 -3
drivers/w1/slaves/w1_bq27000.c
··· 17 17 #include <linux/mutex.h> 18 18 #include <linux/power/bq27xxx_battery.h> 19 19 20 - #include "../w1.h" 21 - #include "../w1_int.h" 22 - #include "../w1_family.h" 20 + #include <linux/w1.h> 21 + 22 + #define W1_FAMILY_BQ27000 0x01 23 23 24 24 #define HDQ_CMD_READ (0) 25 25 #define HDQ_CMD_WRITE (1<<7)
+3 -2
drivers/w1/slaves/w1_ds2405.c
··· 24 24 #include <linux/string.h> 25 25 #include <linux/types.h> 26 26 27 - #include "../w1.h" 28 - #include "../w1_family.h" 27 + #include <linux/w1.h> 28 + 29 + #define W1_FAMILY_DS2405 0x05 29 30 30 31 MODULE_LICENSE("GPL"); 31 32 MODULE_AUTHOR("Maciej S. Szmigiero <mail@maciej.szmigiero.name>");
+3 -3
drivers/w1/slaves/w1_ds2406.c
··· 17 17 #include <linux/slab.h> 18 18 #include <linux/crc16.h> 19 19 20 - #include "../w1.h" 21 - #include "../w1_int.h" 22 - #include "../w1_family.h" 20 + #include <linux/w1.h> 21 + 22 + #define W1_FAMILY_DS2406 0x12 23 23 24 24 #define W1_F12_FUNC_READ_STATUS 0xAA 25 25 #define W1_F12_FUNC_WRITE_STATUS 0x55
+3 -3
drivers/w1/slaves/w1_ds2408.c
··· 15 15 #include <linux/delay.h> 16 16 #include <linux/slab.h> 17 17 18 - #include "../w1.h" 19 - #include "../w1_int.h" 20 - #include "../w1_family.h" 18 + #include <linux/w1.h> 19 + 20 + #define W1_FAMILY_DS2408 0x29 21 21 22 22 #define W1_F29_RETRIES 3 23 23
+3 -3
drivers/w1/slaves/w1_ds2413.c
··· 16 16 #include <linux/delay.h> 17 17 #include <linux/slab.h> 18 18 19 - #include "../w1.h" 20 - #include "../w1_int.h" 21 - #include "../w1_family.h" 19 + #include <linux/w1.h> 20 + 21 + #define W1_FAMILY_DS2413 0x3A 22 22 23 23 #define W1_F3A_RETRIES 3 24 24 #define W1_F3A_FUNC_PIO_ACCESS_READ 0xF5
+3 -3
drivers/w1/slaves/w1_ds2423.c
··· 30 30 #include <linux/delay.h> 31 31 #include <linux/crc16.h> 32 32 33 - #include "../w1.h" 34 - #include "../w1_int.h" 35 - #include "../w1_family.h" 33 + #include <linux/w1.h> 34 + 35 + #define W1_COUNTER_DS2423 0x1D 36 36 37 37 #define CRC16_VALID 0xb001 38 38 #define CRC16_INIT 0
+3 -3
drivers/w1/slaves/w1_ds2431.c
··· 16 16 #include <linux/types.h> 17 17 #include <linux/delay.h> 18 18 19 - #include "../w1.h" 20 - #include "../w1_int.h" 21 - #include "../w1_family.h" 19 + #include <linux/w1.h> 20 + 21 + #define W1_EEPROM_DS2431 0x2D 22 22 23 23 #define W1_F2D_EEPROM_SIZE 128 24 24 #define W1_F2D_PAGE_COUNT 4
+3 -3
drivers/w1/slaves/w1_ds2433.c
··· 22 22 23 23 #endif 24 24 25 - #include "../w1.h" 26 - #include "../w1_int.h" 27 - #include "../w1_family.h" 25 + #include <linux/w1.h> 26 + 27 + #define W1_EEPROM_DS2433 0x23 28 28 29 29 #define W1_EEPROM_SIZE 512 30 30 #define W1_PAGE_COUNT 16
+3 -2
drivers/w1/slaves/w1_ds2438.c
··· 13 13 #include <linux/types.h> 14 14 #include <linux/delay.h> 15 15 16 - #include "../w1.h" 17 - #include "../w1_family.h" 16 + #include <linux/w1.h> 17 + 18 + #define W1_FAMILY_DS2438 0x26 18 19 19 20 #define W1_DS2438_RETRIES 3 20 21
+4 -3
drivers/w1/slaves/w1_ds2760.c
··· 18 18 #include <linux/idr.h> 19 19 #include <linux/gfp.h> 20 20 21 - #include "../w1.h" 22 - #include "../w1_int.h" 23 - #include "../w1_family.h" 21 + #include <linux/w1.h> 22 + 24 23 #include "w1_ds2760.h" 24 + 25 + #define W1_FAMILY_DS2760 0x30 25 26 26 27 static int w1_ds2760_io(struct device *dev, char *buf, int addr, size_t count, 27 28 int io)
+4 -3
drivers/w1/slaves/w1_ds2780.c
··· 21 21 #include <linux/mutex.h> 22 22 #include <linux/idr.h> 23 23 24 - #include "../w1.h" 25 - #include "../w1_int.h" 26 - #include "../w1_family.h" 24 + #include <linux/w1.h> 25 + 27 26 #include "w1_ds2780.h" 27 + 28 + #define W1_FAMILY_DS2780 0x32 28 29 29 30 static int w1_ds2780_do_io(struct device *dev, char *buf, int addr, 30 31 size_t count, int io)
+4 -3
drivers/w1/slaves/w1_ds2781.c
··· 18 18 #include <linux/platform_device.h> 19 19 #include <linux/mutex.h> 20 20 21 - #include "../w1.h" 22 - #include "../w1_int.h" 23 - #include "../w1_family.h" 21 + #include <linux/w1.h> 22 + 24 23 #include "w1_ds2781.h" 24 + 25 + #define W1_FAMILY_DS2781 0x3D 25 26 26 27 static int w1_ds2781_do_io(struct device *dev, char *buf, int addr, 27 28 size_t count, int io)
+3 -3
drivers/w1/slaves/w1_ds28e04.c
··· 20 20 #define CRC16_INIT 0 21 21 #define CRC16_VALID 0xb001 22 22 23 - #include "../w1.h" 24 - #include "../w1_int.h" 25 - #include "../w1_family.h" 23 + #include <linux/w1.h> 24 + 25 + #define W1_FAMILY_DS28E04 0x1C 26 26 27 27 /* Allow the strong pullup to be disabled, but default to enabled. 28 28 * If it was disabled a parasite powered device might not get the required
+4 -3
drivers/w1/slaves/w1_smem.c
··· 27 27 #include <linux/device.h> 28 28 #include <linux/types.h> 29 29 30 - #include "../w1.h" 31 - #include "../w1_int.h" 32 - #include "../w1_family.h" 30 + #include <linux/w1.h> 31 + 32 + #define W1_FAMILY_SMEM_01 0x01 33 + #define W1_FAMILY_SMEM_81 0x81 33 34 34 35 static struct w1_family w1_smem_family_01 = { 35 36 .fid = W1_FAMILY_SMEM_01,
+7 -3
drivers/w1/slaves/w1_therm.c
··· 30 30 #include <linux/slab.h> 31 31 #include <linux/delay.h> 32 32 33 - #include "../w1.h" 34 - #include "../w1_int.h" 35 - #include "../w1_family.h" 33 + #include <linux/w1.h> 34 + 35 + #define W1_THERM_DS18S20 0x10 36 + #define W1_THERM_DS1822 0x22 37 + #define W1_THERM_DS18B20 0x28 38 + #define W1_THERM_DS1825 0x3B 39 + #define W1_THERM_DS28EA00 0x42 36 40 37 41 /* Allow the strong pullup to be disabled, but default to enabled. 38 42 * If it was disabled a parasite powered device might not get the require
+3 -3
drivers/w1/w1.c
··· 28 28 29 29 #include <linux/atomic.h> 30 30 31 - #include "w1.h" 32 - #include "w1_int.h" 33 - #include "w1_family.h" 31 + #include "w1_internal.h" 34 32 #include "w1_netlink.h" 33 + 34 + #define W1_FAMILY_DEFAULT 0 35 35 36 36 static int w1_timeout = 10; 37 37 module_param_named(timeout, w1_timeout, int, 0);
+49 -65
drivers/w1/w1.h include/linux/w1.h
··· 12 12 * GNU General Public License for more details. 13 13 */ 14 14 15 - #ifndef __W1_H 16 - #define __W1_H 15 + #ifndef __LINUX_W1_H 16 + #define __LINUX_W1_H 17 + 18 + #include <linux/device.h> 17 19 18 20 /** 19 21 * struct w1_reg_num - broken out slave device id ··· 24 22 * @id: along with family is the unique device id 25 23 * @crc: checksum of the other bytes 26 24 */ 27 - struct w1_reg_num 28 - { 25 + struct w1_reg_num { 29 26 #if defined(__LITTLE_ENDIAN_BITFIELD) 30 27 __u64 family:8, 31 28 id:48, ··· 40 39 41 40 #ifdef __KERNEL__ 42 41 43 - #include <linux/completion.h> 44 - #include <linux/device.h> 45 - #include <linux/mutex.h> 46 - 47 - #include "w1_family.h" 48 - 49 42 #define W1_MAXNAMELEN 32 50 43 51 44 #define W1_SEARCH 0xF0 ··· 53 58 #define W1_READ_PSUPPLY 0xB4 54 59 #define W1_MATCH_ROM 0x55 55 60 #define W1_RESUME_CMD 0xA5 56 - 57 - #define W1_SLAVE_ACTIVE 0 58 - #define W1_SLAVE_DETACH 1 59 61 60 62 /** 61 63 * struct w1_slave - holds a single slave device on the bus ··· 70 78 * @dev: kernel device identifier 71 79 * 72 80 */ 73 - struct w1_slave 74 - { 81 + struct w1_slave { 75 82 struct module *owner; 76 83 unsigned char name[W1_MAXNAMELEN]; 77 84 struct list_head w1_slave_entry; ··· 86 95 }; 87 96 88 97 typedef void (*w1_slave_found_callback)(struct w1_master *, u64); 89 - 90 98 91 99 /** 92 100 * struct w1_bus_master - operations available on a bus master ··· 132 142 * reset_bus. 133 143 * 134 144 */ 135 - struct w1_bus_master 136 - { 145 + struct w1_bus_master { 137 146 void *data; 138 147 139 148 u8 (*read_bit)(void *); ··· 198 209 * @bus_master: io operations available 199 210 * @seq: sequence number used for netlink broadcasts 200 211 */ 201 - struct w1_master 202 - { 212 + struct w1_master { 203 213 struct list_head w1_master_entry; 204 214 struct module *owner; 205 215 unsigned char name[W1_MAXNAMELEN]; ··· 242 254 u32 seq; 243 255 }; 244 256 257 + int w1_add_master_device(struct w1_bus_master *master); 258 + void w1_remove_master_device(struct w1_bus_master *master); 259 + 245 260 /** 246 - * struct w1_async_cmd - execute callback from the w1_process kthread 247 - * @async_entry: link entry 248 - * @cb: callback function, must list_del and destroy this list before 249 - * returning 250 - * 251 - * When inserted into the w1_master async_list, w1_process will execute 252 - * the callback. Embed this into the structure with the command details. 261 + * struct w1_family_ops - operations for a family type 262 + * @add_slave: add_slave 263 + * @remove_slave: remove_slave 264 + * @groups: sysfs group 253 265 */ 254 - struct w1_async_cmd { 255 - struct list_head async_entry; 256 - void (*cb)(struct w1_master *dev, struct w1_async_cmd *async_cmd); 266 + struct w1_family_ops { 267 + int (*add_slave)(struct w1_slave *sl); 268 + void (*remove_slave)(struct w1_slave *sl); 269 + const struct attribute_group **groups; 257 270 }; 258 271 259 - int w1_create_master_attributes(struct w1_master *); 260 - void w1_destroy_master_attributes(struct w1_master *master); 261 - void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb); 262 - void w1_search_devices(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb); 263 - /* call w1_unref_slave to release the reference counts w1_search_slave added */ 264 - struct w1_slave *w1_search_slave(struct w1_reg_num *id); 265 - /* decrements the reference on sl->master and sl, and cleans up if zero 266 - * returns the reference count after it has been decremented */ 267 - int w1_unref_slave(struct w1_slave *sl); 268 - void w1_slave_found(struct w1_master *dev, u64 rn); 269 - void w1_search_process_cb(struct w1_master *dev, u8 search_type, 270 - w1_slave_found_callback cb); 271 - struct w1_slave *w1_slave_search_device(struct w1_master *dev, 272 - struct w1_reg_num *rn); 273 - struct w1_master *w1_search_master_id(u32 id); 274 - 275 - /* Disconnect and reconnect devices in the given family. Used for finding 276 - * unclaimed devices after a family has been registered or releasing devices 277 - * after a family has been unregistered. Set attach to 1 when a new family 278 - * has just been registered, to 0 when it has been unregistered. 272 + /** 273 + * struct w1_family - reference counted family structure. 274 + * @family_entry: family linked list 275 + * @fid: 8 bit family identifier 276 + * @fops: operations for this family 277 + * @refcnt: reference counter 279 278 */ 280 - void w1_reconnect_slaves(struct w1_family *f, int attach); 281 - int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn); 282 - /* 0 success, otherwise EBUSY */ 283 - int w1_slave_detach(struct w1_slave *sl); 279 + struct w1_family { 280 + struct list_head family_entry; 281 + u8 fid; 282 + 283 + struct w1_family_ops *fops; 284 + 285 + atomic_t refcnt; 286 + }; 287 + 288 + int w1_register_family(struct w1_family *family); 289 + void w1_unregister_family(struct w1_family *family); 290 + 291 + /** 292 + * module_w1_driver() - Helper macro for registering a 1-Wire families 293 + * @__w1_family: w1_family struct 294 + * 295 + * Helper macro for 1-Wire families which do not do anything special in module 296 + * init/exit. This eliminates a lot of boilerplate. Each module may only 297 + * use this macro once, and calling it replaces module_init() and module_exit() 298 + */ 299 + #define module_w1_family(__w1_family) \ 300 + module_driver(__w1_family, w1_register_family, \ 301 + w1_unregister_family) 284 302 285 303 u8 w1_triplet(struct w1_master *dev, int bdir); 286 304 void w1_write_8(struct w1_master *, u8); ··· 315 321 return container_of(dev, struct w1_master, dev); 316 322 } 317 323 318 - extern struct device_driver w1_master_driver; 319 - extern struct device w1_master_device; 320 - extern int w1_max_slave_count; 321 - extern int w1_max_slave_ttl; 322 - extern struct list_head w1_masters; 323 - extern struct mutex w1_mlock; 324 - 325 - extern int w1_process_callbacks(struct w1_master *dev); 326 - extern int w1_process(void *); 327 - 328 324 #endif /* __KERNEL__ */ 329 325 330 - #endif /* __W1_H */ 326 + #endif /* __LINUX_W1_H */
+1 -2
drivers/w1/w1_family.c
··· 18 18 #include <linux/delay.h> 19 19 #include <linux/export.h> 20 20 21 - #include "w1_family.h" 22 - #include "w1.h" 21 + #include "w1_internal.h" 23 22 24 23 DEFINE_SPINLOCK(w1_flock); 25 24 static LIST_HEAD(w1_families);
-98
drivers/w1/w1_family.h
··· 1 - /* 2 - * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> 3 - * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License as published by 6 - * the Free Software Foundation; either version 2 of the License, or 7 - * (at your option) any later version. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - */ 14 - 15 - #ifndef __W1_FAMILY_H 16 - #define __W1_FAMILY_H 17 - 18 - #include <linux/types.h> 19 - #include <linux/device.h> 20 - #include <linux/atomic.h> 21 - 22 - #define W1_FAMILY_DEFAULT 0 23 - #define W1_FAMILY_BQ27000 0x01 24 - #define W1_FAMILY_SMEM_01 0x01 25 - #define W1_FAMILY_SMEM_81 0x81 26 - #define W1_FAMILY_DS2405 0x05 27 - #define W1_THERM_DS18S20 0x10 28 - #define W1_FAMILY_DS28E04 0x1C 29 - #define W1_COUNTER_DS2423 0x1D 30 - #define W1_THERM_DS1822 0x22 31 - #define W1_EEPROM_DS2433 0x23 32 - #define W1_FAMILY_DS2438 0x26 33 - #define W1_THERM_DS18B20 0x28 34 - #define W1_FAMILY_DS2408 0x29 35 - #define W1_EEPROM_DS2431 0x2D 36 - #define W1_FAMILY_DS2760 0x30 37 - #define W1_FAMILY_DS2780 0x32 38 - #define W1_FAMILY_DS2413 0x3A 39 - #define W1_FAMILY_DS2406 0x12 40 - #define W1_THERM_DS1825 0x3B 41 - #define W1_FAMILY_DS2781 0x3D 42 - #define W1_THERM_DS28EA00 0x42 43 - 44 - #define MAXNAMELEN 32 45 - 46 - struct w1_slave; 47 - 48 - /** 49 - * struct w1_family_ops - operations for a family type 50 - * @add_slave: add_slave 51 - * @remove_slave: remove_slave 52 - * @groups: sysfs group 53 - */ 54 - struct w1_family_ops 55 - { 56 - int (* add_slave)(struct w1_slave *); 57 - void (* remove_slave)(struct w1_slave *); 58 - const struct attribute_group **groups; 59 - }; 60 - 61 - /** 62 - * struct w1_family - reference counted family structure. 63 - * @family_entry: family linked list 64 - * @fid: 8 bit family identifier 65 - * @fops: operations for this family 66 - * @refcnt: reference counter 67 - */ 68 - struct w1_family 69 - { 70 - struct list_head family_entry; 71 - u8 fid; 72 - 73 - struct w1_family_ops *fops; 74 - 75 - atomic_t refcnt; 76 - }; 77 - 78 - extern spinlock_t w1_flock; 79 - 80 - void w1_family_put(struct w1_family *); 81 - void __w1_family_get(struct w1_family *); 82 - struct w1_family * w1_family_registered(u8); 83 - void w1_unregister_family(struct w1_family *); 84 - int w1_register_family(struct w1_family *); 85 - 86 - /** 87 - * module_w1_driver() - Helper macro for registering a 1-Wire families 88 - * @__w1_family: w1_family struct 89 - * 90 - * Helper macro for 1-Wire families which do not do anything special in module 91 - * init/exit. This eliminates a lot of boilerplate. Each module may only 92 - * use this macro once, and calling it replaces module_init() and module_exit() 93 - */ 94 - #define module_w1_family(__w1_family) \ 95 - module_driver(__w1_family, w1_register_family, \ 96 - w1_unregister_family) 97 - 98 - #endif /* __W1_FAMILY_H */
+1 -2
drivers/w1/w1_int.c
··· 21 21 #include <linux/export.h> 22 22 #include <linux/moduleparam.h> 23 23 24 - #include "w1.h" 24 + #include "w1_internal.h" 25 25 #include "w1_netlink.h" 26 - #include "w1_int.h" 27 26 28 27 static int w1_search_count = -1; /* Default is continual scan */ 29 28 module_param_named(search_count, w1_search_count, int, 0);
-27
drivers/w1/w1_int.h
··· 1 - /* 2 - * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> 3 - * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License as published by 6 - * the Free Software Foundation; either version 2 of the License, or 7 - * (at your option) any later version. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - */ 14 - 15 - #ifndef __W1_INT_H 16 - #define __W1_INT_H 17 - 18 - #include <linux/kernel.h> 19 - #include <linux/device.h> 20 - 21 - #include "w1.h" 22 - 23 - int w1_add_master_device(struct w1_bus_master *); 24 - void w1_remove_master_device(struct w1_bus_master *); 25 - void __w1_remove_master_device(struct w1_master *); 26 - 27 - #endif /* __W1_INT_H */
+87
drivers/w1/w1_internal.h
··· 1 + /* 2 + * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + */ 14 + 15 + #ifndef __W1_H 16 + #define __W1_H 17 + 18 + #include <linux/w1.h> 19 + 20 + #include <linux/completion.h> 21 + #include <linux/mutex.h> 22 + 23 + #define W1_SLAVE_ACTIVE 0 24 + #define W1_SLAVE_DETACH 1 25 + 26 + /** 27 + * struct w1_async_cmd - execute callback from the w1_process kthread 28 + * @async_entry: link entry 29 + * @cb: callback function, must list_del and destroy this list before 30 + * returning 31 + * 32 + * When inserted into the w1_master async_list, w1_process will execute 33 + * the callback. Embed this into the structure with the command details. 34 + */ 35 + struct w1_async_cmd { 36 + struct list_head async_entry; 37 + void (*cb)(struct w1_master *dev, struct w1_async_cmd *async_cmd); 38 + }; 39 + 40 + int w1_create_master_attributes(struct w1_master *master); 41 + void w1_destroy_master_attributes(struct w1_master *master); 42 + void w1_search(struct w1_master *dev, u8 search_type, 43 + w1_slave_found_callback cb); 44 + void w1_search_devices(struct w1_master *dev, u8 search_type, 45 + w1_slave_found_callback cb); 46 + /* call w1_unref_slave to release the reference counts w1_search_slave added */ 47 + struct w1_slave *w1_search_slave(struct w1_reg_num *id); 48 + /* 49 + * decrements the reference on sl->master and sl, and cleans up if zero 50 + * returns the reference count after it has been decremented 51 + */ 52 + int w1_unref_slave(struct w1_slave *sl); 53 + void w1_slave_found(struct w1_master *dev, u64 rn); 54 + void w1_search_process_cb(struct w1_master *dev, u8 search_type, 55 + w1_slave_found_callback cb); 56 + struct w1_slave *w1_slave_search_device(struct w1_master *dev, 57 + struct w1_reg_num *rn); 58 + struct w1_master *w1_search_master_id(u32 id); 59 + 60 + /* Disconnect and reconnect devices in the given family. Used for finding 61 + * unclaimed devices after a family has been registered or releasing devices 62 + * after a family has been unregistered. Set attach to 1 when a new family 63 + * has just been registered, to 0 when it has been unregistered. 64 + */ 65 + void w1_reconnect_slaves(struct w1_family *f, int attach); 66 + int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn); 67 + /* 0 success, otherwise EBUSY */ 68 + int w1_slave_detach(struct w1_slave *sl); 69 + 70 + void __w1_remove_master_device(struct w1_master *dev); 71 + 72 + void w1_family_put(struct w1_family *f); 73 + void __w1_family_get(struct w1_family *f); 74 + struct w1_family *w1_family_registered(u8 fid); 75 + 76 + extern struct device_driver w1_master_driver; 77 + extern struct device w1_master_device; 78 + extern int w1_max_slave_count; 79 + extern int w1_max_slave_ttl; 80 + extern struct list_head w1_masters; 81 + extern struct mutex w1_mlock; 82 + extern spinlock_t w1_flock; 83 + 84 + int w1_process_callbacks(struct w1_master *dev); 85 + int w1_process(void *data); 86 + 87 + #endif /* __W1_H */
+1 -1
drivers/w1/w1_io.c
··· 18 18 #include <linux/moduleparam.h> 19 19 #include <linux/module.h> 20 20 21 - #include "w1.h" 21 + #include "w1_internal.h" 22 22 23 23 static int w1_delay_parm = 1; 24 24 module_param_named(delay_coef, w1_delay_parm, int, 0);
+1 -1
drivers/w1/w1_netlink.c
··· 17 17 #include <linux/netlink.h> 18 18 #include <linux/connector.h> 19 19 20 - #include "w1.h" 20 + #include "w1_internal.h" 21 21 #include "w1_netlink.h" 22 22 23 23 #if defined(CONFIG_W1_CON) && (defined(CONFIG_CONNECTOR) || (defined(CONFIG_CONNECTOR_MODULE) && defined(CONFIG_W1_MODULE)))
+1 -1
drivers/w1/w1_netlink.h
··· 18 18 #include <asm/types.h> 19 19 #include <linux/connector.h> 20 20 21 - #include "w1.h" 21 + #include "w1_internal.h" 22 22 23 23 /** 24 24 * enum w1_cn_msg_flags - bitfield flags for struct cn_msg.flags