w1: Search the SGI 1-wire buses only once
cover w1: Search the SGI 1-wire buses only once
The slaves on the SGI 1-wire buses are soldered to the board, yet the w1 core rescans each bus every 10 seconds, busy-waiting through the time slots.
Patch 1 lets a bus master set its search count, and patch 2 has sgi_w1 search once.
Tested on an Octane.
Imre Kaloz (2):
w1: Let bus masters set the search count
w1: sgi_w1: Search the bus only once
drivers/w1/masters/sgi_w1.c | 3 +++ drivers/w1/w1_int.c | 3 +++ include/linux/w1.h | 5 +++++ 3 files changed, 11 insertions(+)
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
Signature · 1 line
2.47.3
PATCH 1/2 w1: Let bus masters set the search count
A master whose slaves cannot change after probe gains nothing from repeated searches. Let the master set the number of automatic searches on its bus; zero keeps the search_count module parameter.
--- drivers/w1/w1_int.c | 3 +++ include/linux/w1.h | 5 +++++ 2 files changed, 8 insertions(+)
drivers/w1/w1_int.c +3 -0
@@ -130,6 +130,9 @@ int w1_add_master_device(struct w1_bus_master *master)memcpy (dev->bus_master, master,sizeof (struct w1_bus_master )); +if (master->search_count) + dev->search_count = master->search_count; + dev->initialized =1 ; dev->thread =kthread_run (&w1_process, dev,"%s" , dev->name);
include/linux/w1.h +5 -0
@@ -122,6 +122,9 @@ typedef void (*w1_slave_found_callback)(struct w1_master *, u64);* @dev_id: Optional device id string, which w1 slaves could use for * creating names, which then give a connection to the w1 master * +* @search_count: Optional number of automatic searches to run on this +* bus, -1 for unlimited; 0 uses the search_count module parameter +* * Note: read_bit and write_bit are very low level functions and should only * be used with hardware that doesn't really support 1-wire operations, * like a parallel/serial port.
@@ -156,6 +159,8 @@ struct w1_bus_master { u8, w1_slave_found_callback);char *dev_id; + +int search_count; };/**
Signature · 1 line
2.47.3
PATCH 2/2 w1: sgi_w1: Search the bus only once
In reply to Imre KalozThe slaves on this bus are soldered to the board, so rescanning it every timeout period only busy-waits through the time slots.
--- drivers/w1/masters/sgi_w1.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/w1/masters/sgi_w1.c +3 -0
@@ -90,6 +90,9 @@ static int sgi_w1_probe(struct platform_device *pdev) sdev->bus_master.reset_bus = sgi_w1_reset_bus; sdev->bus_master.touch_bit = sgi_w1_touch_bit; +/* The slaves are soldered on; one search finds them all. */ + sdev->bus_master.search_count =1 ; + pdata =dev_get_platdata (&pdev->dev);if (pdata) {strscpy (sdev->dev_id, pdata->dev_id,sizeof (sdev->dev_id));
Signature · 1 line
2.47.3
Quoted 8 lines · Imre Kaloz
The slaves on the SGI 1-wire buses are soldered to the board, yet the w1 core rescans each bus every 10 seconds, busy-waiting through the time slots.
Patch 1 lets a bus master set its search count, and patch 2 has
sgi_w1search once.[...]
Applied, thanks!
[1/2] w1: Let bus masters set the search count
https://git.kernel.org/krzk/linux-w1/c/c6c851e7499ebd075590a6c1ed1a707cf05f4058 [2/2] w1: sgi_w1: Search the bus only once https://git.kernel.org/krzk/linux-w1/c/e8bb5d130f2592632897aaa8e4e05a908a4847d6
Best regards,
Signature · 1 line
Krzysztof Kozlowski <[email protected]>