Skip to contentSkip to conversation

Add public w1 driver interface

PATCH In review Andrew F. Davis 2 participants 6 messages Mar 16, 2017 – May 1, 2017 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Add public w1 driver interface

Hi All,

As part of continuing work to cleanup the BQ27xxx driver I am attempting to remove the need for the platform driver interface. For this we first need the w1 subsystem to act more like a traditional bus subsystem and allow drivers for attached devices to live outside of the w1 directory.

The first couple patches are trivial, the last a bit more involved but should make no functional change, just a re-organization of header files.

Thanks,
Andrew

Andrew F. Davis (3):
w1: Use kernel common min() implementation
w1: Remove unneeded use of assert() and remove w1_log.h
w1: Add subsystem kernel public interface

 MAINTAINERS                        |   1 +
 drivers/w1/masters/ds1wm.c         |   3 +-
 drivers/w1/masters/ds2482.c        |   3 +-
 drivers/w1/masters/ds2490.c        |   3 +-
 drivers/w1/masters/matrox_w1.c     |   9 +--
 drivers/w1/masters/mxc_w1.c        |   3 +-
 drivers/w1/masters/omap_hdq.c      |   3 +-
 drivers/w1/masters/w1-gpio.c       |   3 +-
 drivers/w1/slaves/w1_bq27000.c     |   6 +-
 drivers/w1/slaves/w1_ds2405.c      |   5 +-
 drivers/w1/slaves/w1_ds2406.c      |   6 +-
 drivers/w1/slaves/w1_ds2408.c      |   6 +-
 drivers/w1/slaves/w1_ds2413.c      |   6 +-
 drivers/w1/slaves/w1_ds2423.c      |   6 +-
 drivers/w1/slaves/w1_ds2431.c      |   6 +-
 drivers/w1/slaves/w1_ds2433.c      |   6 +-
 drivers/w1/slaves/w1_ds2760.c      |   7 ++-
 drivers/w1/slaves/w1_ds2780.c      |   7 ++-
 drivers/w1/slaves/w1_ds2781.c      |   7 ++-
 drivers/w1/slaves/w1_ds28e04.c     |   6 +-
 drivers/w1/slaves/w1_smem.c        |   7 ++-
 drivers/w1/slaves/w1_therm.c       |  10 +++-
 drivers/w1/w1.c                    |   7 +--
 drivers/w1/w1_family.c             |   3 +-
 drivers/w1/w1_family.h             |  97 -------------------------------
 drivers/w1/w1_int.c                |   4 +-
 drivers/w1/w1_int.h                |  27 ---------
 drivers/w1/w1_internal.h           |  87 ++++++++++++++++++++++++++++
 drivers/w1/w1_io.c                 |   3 +-
 drivers/w1/w1_log.h                |  31 ----------
 drivers/w1/w1_netlink.c            |   7 +--
 drivers/w1/w1_netlink.h            |   2 +-
 {drivers/w1 => include/linux}/w1.h | 116 ++++++++++++++++---------------------
 33 files changed, 205 insertions(+), 298 deletions(-)
 delete mode 100644 drivers/w1/w1_family.h
 delete mode 100644 drivers/w1/w1_int.h
 create mode 100644 drivers/w1/w1_internal.h
 delete mode 100644 drivers/w1/w1_log.h
 rename {drivers/w1 => include/linux}/w1.h (76%)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/3 w1: Use kernel common min() implementation

---
 drivers/w1/w1_netlink.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/w1/w1_netlink.c +1 -3
index 49e520ca79c5..18374cad3ace 100644
@@ -23,8 +23,6 @@
 
 #if defined(CONFIG_W1_CON) && (defined(CONFIG_CONNECTOR) || (defined(CONFIG_CONNECTOR_MODULE) && defined(CONFIG_W1_MODULE)))
 
-#define MIN(a, b)                   (((a) < (b)) ? (a) : (b))
-
 /* Bundle together everything required to process a request in one memory
  * allocation.
  */
@@ -598,7 +596,7 @@ static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp)
 				sizeof(struct w1_netlink_msg) +
 				sizeof(struct w1_netlink_cmd));
 		}
-		reply_size = MIN(CONNECTOR_MAX_MSG_SIZE, reply_size);
+		reply_size = min(CONNECTOR_MAX_MSG_SIZE, reply_size);
 
 		/* allocate space for the block, a copy of the original message,
 		 * one node per cmd to point into the original message,
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/3 w1: Remove unneeded use of assert() and remove w1_log.h

In reply to Andrew F. Davis

The only use of assert() is in matrox_w1.c and is used to check the input to probe() from the PCI subsystem for NULL values, these are guaranteed to be populated and no other PCI driver makes this check, remove this.

As this was the only definition in w1_log.h, remove this also.

---
 drivers/w1/masters/matrox_w1.c |  6 ------
 drivers/w1/w1.c                |  1 -
 drivers/w1/w1_int.c            |  1 -
 drivers/w1/w1_io.c             |  1 -
 drivers/w1/w1_log.h            | 31 -------------------------------
 drivers/w1/w1_netlink.c        |  1 -
 6 files changed, 41 deletions(-)
 delete mode 100644 drivers/w1/w1_log.h
drivers/w1/masters/matrox_w1.c +0 -6
index cbdf4c9d895c..f20d03ecfd1d 100644
@@ -36,7 +36,6 @@
 
 #include "../w1.h"
 #include "../w1_int.h"
-#include "../w1_log.h"
 
 /*
  * Matrox G400 DDC registers.
@@ -134,9 +133,6 @@ static int matrox_w1_probe(struct pci_dev *pdev, const struct pci_device_id *ent
 	struct matrox_device *dev;
 	int err;
 
-	assert(pdev != NULL);
-	assert(ent != NULL);
-
 	if (pdev->vendor != PCI_VENDOR_ID_MATROX || pdev->device != PCI_DEVICE_ID_MATROX_G400)
 		return -ENODEV;
 
@@ -201,8 +197,6 @@ static void matrox_w1_remove(struct pci_dev *pdev)
 {
 	struct matrox_device *dev = pci_get_drvdata(pdev);
 
-	assert(dev != NULL);
-
 	if (dev->found) {
 		w1_remove_master_device(dev->bus_master);
 		iounmap(dev->virt_addr);
drivers/w1/w1.c +0 -1
index 281abfd369b8..8172dee5e23c 100644
@@ -29,7 +29,6 @@
 #include <linux/atomic.h>
 
 #include "w1.h"
-#include "w1_log.h"
 #include "w1_int.h"
 #include "w1_family.h"
 #include "w1_netlink.h"
drivers/w1/w1_int.c +0 -1
index 0a3b1ea25765..4439d10709bb 100644
@@ -22,7 +22,6 @@
 #include <linux/moduleparam.h>
 
 #include "w1.h"
-#include "w1_log.h"
 #include "w1_netlink.h"
 #include "w1_int.h"
 
drivers/w1/w1_io.c +0 -1
index de8bebc27896..1134e6b1eb02 100644
@@ -19,7 +19,6 @@
 #include <linux/module.h>
 
 #include "w1.h"
-#include "w1_log.h"
 
 static int w1_delay_parm = 1;
 module_param_named(delay_coef, w1_delay_parm, int, 0);
drivers/w1/w1_log.h deleted +0 -31
deleted file mode 100644
index dd1422b6afbb..000000000000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2004 Evgeniy Polyakov <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __W1_LOG_H
-#define __W1_LOG_H
-
-#define DEBUG
-
-#ifdef W1_DEBUG
-#  define assert(expr) do {} while (0)
-#else
-#  define assert(expr) \
-        if(unlikely(!(expr))) {				        \
-		pr_err("Assertion failed! %s,%s,%s,line=%d\n",	\
-		#expr, __FILE__, __func__, __LINE__);		\
-        }
-#endif
-
-#endif /* __W1_LOG_H */
-
drivers/w1/w1_netlink.c +0 -1
index 18374cad3ace..027950f997d1 100644
@@ -18,7 +18,6 @@
 #include <linux/connector.h>
 
 #include "w1.h"
-#include "w1_log.h"
 #include "w1_netlink.h"
 
 #if defined(CONFIG_W1_CON) && (defined(CONFIG_CONNECTOR) || (defined(CONFIG_CONNECTOR_MODULE) && defined(CONFIG_W1_MODULE)))
Signature · 1 line
2.11.0
#3 lore raw

PATCH 3/3 w1: Add subsystem kernel public interface

In reply to Andrew F. Davis

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.

---
 MAINTAINERS                        |   1 +
 drivers/w1/masters/ds1wm.c         |   3 +-
 drivers/w1/masters/ds2482.c        |   3 +-
 drivers/w1/masters/ds2490.c        |   3 +-
 drivers/w1/masters/matrox_w1.c     |   3 +-
 drivers/w1/masters/mxc_w1.c        |   3 +-
 drivers/w1/masters/omap_hdq.c      |   3 +-
 drivers/w1/masters/w1-gpio.c       |   3 +-
 drivers/w1/slaves/w1_bq27000.c     |   6 +-
 drivers/w1/slaves/w1_ds2405.c      |   5 +-
 drivers/w1/slaves/w1_ds2406.c      |   6 +-
 drivers/w1/slaves/w1_ds2408.c      |   6 +-
 drivers/w1/slaves/w1_ds2413.c      |   6 +-
 drivers/w1/slaves/w1_ds2423.c      |   6 +-
 drivers/w1/slaves/w1_ds2431.c      |   6 +-
 drivers/w1/slaves/w1_ds2433.c      |   6 +-
 drivers/w1/slaves/w1_ds2760.c      |   7 ++-
 drivers/w1/slaves/w1_ds2780.c      |   7 ++-
 drivers/w1/slaves/w1_ds2781.c      |   7 ++-
 drivers/w1/slaves/w1_ds28e04.c     |   6 +-
 drivers/w1/slaves/w1_smem.c        |   7 ++-
 drivers/w1/slaves/w1_therm.c       |  10 +++-
 drivers/w1/w1.c                    |   6 +-
 drivers/w1/w1_family.c             |   3 +-
 drivers/w1/w1_family.h             |  97 -------------------------------
 drivers/w1/w1_int.c                |   3 +-
 drivers/w1/w1_int.h                |  27 ---------
 drivers/w1/w1_internal.h           |  87 ++++++++++++++++++++++++++++
 drivers/w1/w1_io.c                 |   2 +-
 drivers/w1/w1_netlink.c            |   2 +-
 drivers/w1/w1_netlink.h            |   2 +-
 {drivers/w1 => include/linux}/w1.h | 116 ++++++++++++++++---------------------
 32 files changed, 204 insertions(+), 254 deletions(-)
 delete mode 100644 drivers/w1/w1_family.h
 delete mode 100644 drivers/w1/w1_int.h
 create mode 100644 drivers/w1/w1_internal.h
 rename {drivers/w1 => include/linux}/w1.h (76%)
MAINTAINERS +1 -0
index c265a5fe4848..ff52c1b2e167 100644
@@ -13500,6 +13500,7 @@ M:	Evgeniy Polyakov <[email protected]>
 S:	Maintained
 F:	Documentation/w1/
 F:	drivers/w1/
+F:	include/linux/w1.h
 
 W83791D HARDWARE MONITORING DRIVER
 M:	Marc Hulsman <[email protected]>
drivers/w1/masters/ds1wm.c +1 -2
index e0b8a4bc73df..fd2e9da27c4b 100644
@@ -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 */
drivers/w1/masters/ds2482.c +1 -2
index e8730ea3e3aa..d49681cd29af 100644
@@ -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.
drivers/w1/masters/ds2490.c +1 -2
index d748e34d4ce5..46ccb2fc4f60 100644
@@ -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 */
drivers/w1/masters/matrox_w1.c +1 -2
index f20d03ecfd1d..d83d7c99d81d 100644
@@ -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.
drivers/w1/masters/mxc_w1.c +1 -2
index a4621757a47f..74f2e6e6202a 100644
@@ -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
drivers/w1/masters/omap_hdq.c +1 -2
index 3302cbd2344a..3612542b6044 100644
@@ -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:"
 
drivers/w1/masters/w1-gpio.c +1 -2
index a373ae69d9f6..a90728ceec5a 100644
@@ -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)
 {
drivers/w1/slaves/w1_bq27000.c +3 -3
index d480900a28ab..8046ac45381a 100644
@@ -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)
drivers/w1/slaves/w1_ds2405.c +3 -2
index d5d54876cb64..42a1e81060ce 100644
@@ -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 <[email protected]>");
drivers/w1/slaves/w1_ds2406.c +3 -3
index 709bd5e02eed..fac266366ca3 100644
@@ -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
drivers/w1/slaves/w1_ds2408.c +3 -3
index e01d2b3997bc..b535d5ec35b6 100644
@@ -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
 
drivers/w1/slaves/w1_ds2413.c +3 -3
index 9cc6f0bc2e95..492e3d010321 100644
@@ -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
drivers/w1/slaves/w1_ds2423.c +3 -3
index 306240fe496c..050407c53b16 100644
@@ -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
drivers/w1/slaves/w1_ds2431.c +3 -3
index 20182d4a4b19..5adecd3face1 100644
@@ -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
drivers/w1/slaves/w1_ds2433.c +3 -3
index 86c30aceea3e..75ad70cfe8e8 100644
@@ -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
drivers/w1/slaves/w1_ds2760.c +4 -3
index f35d1e2ef9bb..26168abfb8b8 100644
@@ -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)
 {
drivers/w1/slaves/w1_ds2780.c +4 -3
index 292972212107..a60528131154 100644
@@ -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)
 {
drivers/w1/slaves/w1_ds2781.c +4 -3
index a5d75067b230..645be6e0b24a 100644
@@ -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)
 {
drivers/w1/slaves/w1_ds28e04.c +3 -3
index c62858c05e8f..ec234b846eb3 100644
@@ -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
drivers/w1/slaves/w1_smem.c +4 -3
index 99b03bfb9941..e556b0caff71 100644
@@ -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,
drivers/w1/slaves/w1_therm.c +7 -3
index ccaf29994a42..cb3fc3c6b0d1 100644
@@ -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
drivers/w1/w1.c +3 -3
index 8172dee5e23c..95ea7e6b1d99 100644
@@ -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");
drivers/w1/w1_family.c +1 -2
index 9759cdaf22f4..f14ab0b340b5 100644
@@ -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);
drivers/w1/w1_family.h deleted +0 -97

97 lines not on this page · raw message

drivers/w1/w1_int.c +1 -2
index 4439d10709bb..1c776178f598 100644
@@ -21,9 +21,8 @@
 #include <linux/export.h>
 #include <linux/moduleparam.h>
 
-#include "w1.h"
+#include "w1_internal.h"
 #include "w1_netlink.h"
-#include "w1_int.h"
 
 static int w1_search_count = -1; /* Default is continual scan */
 module_param_named(search_count, w1_search_count, int, 0);
drivers/w1/w1_int.h deleted +0 -27
deleted file mode 100644
index 371989159216..000000000000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2004 Evgeniy Polyakov <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __W1_INT_H
-#define __W1_INT_H
-
-#include <linux/kernel.h>
-#include <linux/device.h>
-
-#include "w1.h"
-
-int w1_add_master_device(struct w1_bus_master *);
-void w1_remove_master_device(struct w1_bus_master *);
-void __w1_remove_master_device(struct w1_master *);
-
-#endif /* __W1_INT_H */
drivers/w1/w1_internal.h new file +87 -0

87 lines not on this page · raw message

drivers/w1/w1_io.c +1 -1
index 1134e6b1eb02..d191e1f80579 100644
@@ -18,7 +18,7 @@
 #include <linux/moduleparam.h>
 #include <linux/module.h>
 
-#include "w1.h"
+#include "w1_internal.h"
 
 static int w1_delay_parm = 1;
 module_param_named(delay_coef, w1_delay_parm, int, 0);
drivers/w1/w1_netlink.c +1 -1
index 027950f997d1..f2f099caeb77 100644
@@ -17,7 +17,7 @@
 #include <linux/netlink.h>
 #include <linux/connector.h>
 
-#include "w1.h"
+#include "w1_internal.h"
 #include "w1_netlink.h"
 
 #if defined(CONFIG_W1_CON) && (defined(CONFIG_CONNECTOR) || (defined(CONFIG_CONNECTOR_MODULE) && defined(CONFIG_W1_MODULE)))
drivers/w1/w1_netlink.h +1 -1
index b389e5ff5fa5..a36661cd1f05 100644
@@ -18,7 +18,7 @@
 #include <asm/types.h>
 #include <linux/connector.h>
 
-#include "w1.h"
+#include "w1_internal.h"
 
 /**
  * enum w1_cn_msg_flags - bitfield flags for struct cn_msg.flags
include/linux/w1.h renamed from drivers/w1/w1.h +51 -65

185 lines not on this page · raw message

Signature · 1 line
2.11.0
Reviewed-by on the v1 series
#6 lore raw
In reply to Andrew F. Davis

Hi,

Quoted 10 lines · Andrew F. Davis

As part of continuing work to cleanup the BQ27xxx driver I am attempting to remove the need for the platform driver interface. For this we first need the w1 subsystem to act more like a traditional bus subsystem and allow drivers for attached devices to live outside of the w1 directory.

The first couple patches are trivial, the last a bit more involved but should make no functional change, just a re-organization of header files.

Quoted 7 lines

Thanks,
Andrew

Andrew F. Davis (3):
w1: Use kernel common min() implementation
w1: Remove unneeded use of assert() and remove w1_log.h
w1: Add subsystem kernel public interface

For the whole series:

-- Sebastian

#5 lore raw

Re: [PATCH 3/3] w1: Add subsystem kernel public interface

In reply to a message not in the archive
Quoted 14 lines · Evgeniy Polyakov

Hi everyone

16.03.2017, 18:20, "Andrew F. Davis" <[email protected]>:

Quoted 8 lines

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.

w1_int.h was a shortname for w1_internal.h actually

Quoted 8 lines
Quoted 3 lines

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.

I'm not against this patch per-se, I especially like linux/w1 include instead of ../w1.h, quite curious why didn't I move include file into linux directory in the first place, but please elaborate why is this needed?

I'm moving the bq27xxx driver out of w1 and into power/supply where it should be, see:
https://lkml.org/lkml/2017/3/16/688

Quoted 2 lines

Also I do not agree with TI copyright in the new inclusion file which is merely a movement of the old file.

There is more going on that just moving the file, this was a lot of re-work, also I kept your copyright, is it a problem to add another? If so I'm fine with that too and can remove it.

Andrew