Skip to content

Commit

Permalink
w1: Add subsystem kernel public interface
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
glneo authored and gregkh committed Jun 9, 2017
1 parent acb7e8f commit de0d6db
Show file tree
Hide file tree
Showing 36 changed files with 208 additions and 260 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -13790,6 +13790,7 @@ M: Evgeniy Polyakov <zbr@ioremap.net>
S: Maintained
F: Documentation/w1/
F: drivers/w1/
F: include/linux/w1.h

W83791D HARDWARE MONITORING DRIVER
M: Marc Hulsman <m.hulsman@tudelft.nl>
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/supply/ds2760_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <linux/platform_device.h>
#include <linux/power_supply.h>

#include "../../w1/w1.h"
#include <linux/w1.h>
#include "../../w1/slaves/w1_ds2760.h"

struct ds2760_device_info {
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/supply/ds2780_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <linux/power_supply.h>
#include <linux/idr.h>

#include "../../w1/w1.h"
#include <linux/w1.h>
#include "../../w1/slaves/w1_ds2780.h"

/* Current unit measurement in uA for a 1 milli-ohm sense resistor */
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/supply/ds2781_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <linux/power_supply.h>
#include <linux/idr.h>

#include "../../w1/w1.h"
#include <linux/w1.h>
#include "../../w1/slaves/w1_ds2781.h"

/* Current unit measurement in uA for a 1 milli-ohm sense resistor */
Expand Down
3 changes: 1 addition & 2 deletions drivers/w1/masters/ds1wm.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

#include <asm/io.h>

#include "../w1.h"
#include "../w1_int.h"
#include <linux/w1.h>


#define DS1WM_CMD 0x00 /* R/W 4 bits command */
Expand Down
3 changes: 1 addition & 2 deletions drivers/w1/masters/ds2482.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#include <linux/delay.h>
#include <asm/delay.h>

#include "../w1.h"
#include "../w1_int.h"
#include <linux/w1.h>

/**
* Allow the active pullup to be disabled, default is enabled.
Expand Down
3 changes: 1 addition & 2 deletions drivers/w1/masters/ds2490.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
#include <linux/usb.h>
#include <linux/slab.h>

#include "../w1_int.h"
#include "../w1.h"
#include <linux/w1.h>

/* USB Standard */
/* USB Control request vendor type */
Expand Down
3 changes: 1 addition & 2 deletions drivers/w1/masters/matrox_w1.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
#include <linux/pci_ids.h>
#include <linux/pci.h>

#include "../w1.h"
#include "../w1_int.h"
#include <linux/w1.h>

/*
* Matrox G400 DDC registers.
Expand Down
3 changes: 1 addition & 2 deletions drivers/w1/masters/mxc_w1.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#include <linux/module.h>
#include <linux/platform_device.h>

#include "../w1.h"
#include "../w1_int.h"
#include <linux/w1.h>

/*
* MXC W1 Register offsets
Expand Down
3 changes: 1 addition & 2 deletions drivers/w1/masters/omap_hdq.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#include <linux/pm_runtime.h>
#include <linux/of.h>

#include "../w1.h"
#include "../w1_int.h"
#include <linux/w1.h>

#define MOD_NAME "OMAP_HDQ:"

Expand Down
3 changes: 1 addition & 2 deletions drivers/w1/masters/w1-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#include <linux/of.h>
#include <linux/delay.h>

#include "../w1.h"
#include "../w1_int.h"
#include <linux/w1.h>

static u8 w1_gpio_set_pullup(void *data, int delay)
{
Expand Down
6 changes: 3 additions & 3 deletions drivers/w1/slaves/w1_bq27000.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#include <linux/mutex.h>
#include <linux/power/bq27xxx_battery.h>

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#define W1_FAMILY_BQ27000 0x01

#define HDQ_CMD_READ (0)
#define HDQ_CMD_WRITE (1<<7)
Expand Down
5 changes: 3 additions & 2 deletions drivers/w1/slaves/w1_ds2405.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
#include <linux/string.h>
#include <linux/types.h>

#include "../w1.h"
#include "../w1_family.h"
#include <linux/w1.h>

#define W1_FAMILY_DS2405 0x05

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Maciej S. Szmigiero <mail@maciej.szmigiero.name>");
Expand Down
6 changes: 3 additions & 3 deletions drivers/w1/slaves/w1_ds2406.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#include <linux/slab.h>
#include <linux/crc16.h>

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#define W1_FAMILY_DS2406 0x12

#define W1_F12_FUNC_READ_STATUS 0xAA
#define W1_F12_FUNC_WRITE_STATUS 0x55
Expand Down
6 changes: 3 additions & 3 deletions drivers/w1/slaves/w1_ds2408.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#include <linux/delay.h>
#include <linux/slab.h>

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#define W1_FAMILY_DS2408 0x29

#define W1_F29_RETRIES 3

Expand Down
6 changes: 3 additions & 3 deletions drivers/w1/slaves/w1_ds2413.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#include <linux/delay.h>
#include <linux/slab.h>

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#define W1_FAMILY_DS2413 0x3A

#define W1_F3A_RETRIES 3
#define W1_F3A_FUNC_PIO_ACCESS_READ 0xF5
Expand Down
6 changes: 3 additions & 3 deletions drivers/w1/slaves/w1_ds2423.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
#include <linux/delay.h>
#include <linux/crc16.h>

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#define W1_COUNTER_DS2423 0x1D

#define CRC16_VALID 0xb001
#define CRC16_INIT 0
Expand Down
6 changes: 3 additions & 3 deletions drivers/w1/slaves/w1_ds2431.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#include <linux/types.h>
#include <linux/delay.h>

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#define W1_EEPROM_DS2431 0x2D

#define W1_F2D_EEPROM_SIZE 128
#define W1_F2D_PAGE_COUNT 4
Expand Down
6 changes: 3 additions & 3 deletions drivers/w1/slaves/w1_ds2433.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

#endif

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#define W1_EEPROM_DS2433 0x23

#define W1_EEPROM_SIZE 512
#define W1_PAGE_COUNT 16
Expand Down
5 changes: 3 additions & 2 deletions drivers/w1/slaves/w1_ds2438.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
#include <linux/types.h>
#include <linux/delay.h>

#include "../w1.h"
#include "../w1_family.h"
#include <linux/w1.h>

#define W1_FAMILY_DS2438 0x26

#define W1_DS2438_RETRIES 3

Expand Down
7 changes: 4 additions & 3 deletions drivers/w1/slaves/w1_ds2760.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
#include <linux/idr.h>
#include <linux/gfp.h>

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#include "w1_ds2760.h"

#define W1_FAMILY_DS2760 0x30

static int w1_ds2760_io(struct device *dev, char *buf, int addr, size_t count,
int io)
{
Expand Down
7 changes: 4 additions & 3 deletions drivers/w1/slaves/w1_ds2780.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
#include <linux/mutex.h>
#include <linux/idr.h>

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#include "w1_ds2780.h"

#define W1_FAMILY_DS2780 0x32

static int w1_ds2780_do_io(struct device *dev, char *buf, int addr,
size_t count, int io)
{
Expand Down
7 changes: 4 additions & 3 deletions drivers/w1/slaves/w1_ds2781.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
#include <linux/platform_device.h>
#include <linux/mutex.h>

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#include "w1_ds2781.h"

#define W1_FAMILY_DS2781 0x3D

static int w1_ds2781_do_io(struct device *dev, char *buf, int addr,
size_t count, int io)
{
Expand Down
6 changes: 3 additions & 3 deletions drivers/w1/slaves/w1_ds28e04.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#define CRC16_INIT 0
#define CRC16_VALID 0xb001

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#define W1_FAMILY_DS28E04 0x1C

/* Allow the strong pullup to be disabled, but default to enabled.
* If it was disabled a parasite powered device might not get the required
Expand Down
7 changes: 4 additions & 3 deletions drivers/w1/slaves/w1_smem.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
#include <linux/device.h>
#include <linux/types.h>

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#define W1_FAMILY_SMEM_01 0x01
#define W1_FAMILY_SMEM_81 0x81

static struct w1_family w1_smem_family_01 = {
.fid = W1_FAMILY_SMEM_01,
Expand Down
10 changes: 7 additions & 3 deletions drivers/w1/slaves/w1_therm.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@
#include <linux/slab.h>
#include <linux/delay.h>

#include "../w1.h"
#include "../w1_int.h"
#include "../w1_family.h"
#include <linux/w1.h>

#define W1_THERM_DS18S20 0x10
#define W1_THERM_DS1822 0x22
#define W1_THERM_DS18B20 0x28
#define W1_THERM_DS1825 0x3B
#define W1_THERM_DS28EA00 0x42

/* Allow the strong pullup to be disabled, but default to enabled.
* If it was disabled a parasite powered device might not get the require
Expand Down
6 changes: 3 additions & 3 deletions drivers/w1/w1.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@

#include <linux/atomic.h>

#include "w1.h"
#include "w1_int.h"
#include "w1_family.h"
#include "w1_internal.h"
#include "w1_netlink.h"

#define W1_FAMILY_DEFAULT 0

static int w1_timeout = 10;
module_param_named(timeout, w1_timeout, int, 0);
MODULE_PARM_DESC(timeout, "time in seconds between automatic slave searches");
Expand Down
3 changes: 1 addition & 2 deletions drivers/w1/w1_family.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#include <linux/delay.h>
#include <linux/export.h>

#include "w1_family.h"
#include "w1.h"
#include "w1_internal.h"

DEFINE_SPINLOCK(w1_flock);
static LIST_HEAD(w1_families);
Expand Down
Loading

0 comments on commit de0d6db

Please sign in to comment.