From 70b34d2ed807b722413894975a8c60617defb887 Mon Sep 17 00:00:00 2001 From: David Fries Date: Wed, 15 Jan 2014 22:29:17 -0600 Subject: w1: new netlink commands, add/remove/list slaves Introduce new commands to add, remove, and list slave devices through the netlink interface. This can be useful to skip the search on a static network. They could previously only be added or removed through automatic search or sysfs, and this allows a program to only use netlink. Only allocate memory when needed, so move kzalloc into w1_get_slaves where it was used. Signed-off-by: David Fries Acked-by: Evgeniy Polyakov Signed-off-by: Greg Kroah-Hartman --- drivers/w1/w1.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/w1/w1.c') diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 4c89f85edfe6..97b35cb8b6da 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c @@ -56,8 +56,6 @@ module_param_named(slave_ttl, w1_max_slave_ttl, int, 0); DEFINE_MUTEX(w1_mlock); LIST_HEAD(w1_masters); -static int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn); - static int w1_master_match(struct device *dev, struct device_driver *drv) { return 1; @@ -444,7 +442,7 @@ static int w1_atoreg_num(struct device *dev, const char *buf, size_t count, /* Searches the slaves in the w1_master and returns a pointer or NULL. * Note: must hold the mutex */ -static struct w1_slave *w1_slave_search_device(struct w1_master *dev, +struct w1_slave *w1_slave_search_device(struct w1_master *dev, struct w1_reg_num *rn) { struct w1_slave *sl; @@ -711,7 +709,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl) return 0; } -static int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn) +int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn) { struct w1_slave *sl; struct w1_family *f; -- cgit v1.2.3