diff options
-rw-r--r-- | drivers/w1/w1.h | 1 | ||||
-rw-r--r-- | drivers/w1/w1_io.c | 26 | ||||
-rw-r--r-- | drivers/w1/w1_netlink.c | 11 | ||||
-rw-r--r-- | drivers/w1/w1_netlink.h | 1 |
4 files changed, 35 insertions, 4 deletions
diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h index 97304bd83ec9..d8a9709f3449 100644 --- a/drivers/w1/w1.h +++ b/drivers/w1/w1.h | |||
@@ -210,6 +210,7 @@ u8 w1_read_8(struct w1_master *); | |||
210 | int w1_reset_bus(struct w1_master *); | 210 | int w1_reset_bus(struct w1_master *); |
211 | u8 w1_calc_crc8(u8 *, int); | 211 | u8 w1_calc_crc8(u8 *, int); |
212 | void w1_write_block(struct w1_master *, const u8 *, int); | 212 | void w1_write_block(struct w1_master *, const u8 *, int); |
213 | void w1_touch_block(struct w1_master *, u8 *, int); | ||
213 | u8 w1_read_block(struct w1_master *, u8 *, int); | 214 | u8 w1_read_block(struct w1_master *, u8 *, int); |
214 | int w1_reset_select_slave(struct w1_slave *sl); | 215 | int w1_reset_select_slave(struct w1_slave *sl); |
215 | void w1_next_pullup(struct w1_master *, int); | 216 | void w1_next_pullup(struct w1_master *, int); |
diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c index 5139c25ca962..442bd8bbd4a5 100644 --- a/drivers/w1/w1_io.c +++ b/drivers/w1/w1_io.c | |||
@@ -238,7 +238,6 @@ EXPORT_SYMBOL_GPL(w1_read_8); | |||
238 | * @param dev the master device | 238 | * @param dev the master device |
239 | * @param buf pointer to the data to write | 239 | * @param buf pointer to the data to write |
240 | * @param len the number of bytes to write | 240 | * @param len the number of bytes to write |
241 | * @return the byte read | ||
242 | */ | 241 | */ |
243 | void w1_write_block(struct w1_master *dev, const u8 *buf, int len) | 242 | void w1_write_block(struct w1_master *dev, const u8 *buf, int len) |
244 | { | 243 | { |
@@ -256,6 +255,31 @@ void w1_write_block(struct w1_master *dev, const u8 *buf, int len) | |||
256 | EXPORT_SYMBOL_GPL(w1_write_block); | 255 | EXPORT_SYMBOL_GPL(w1_write_block); |
257 | 256 | ||
258 | /** | 257 | /** |
258 | * Touches a series of bytes. | ||
259 | * | ||
260 | * @param dev the master device | ||
261 | * @param buf pointer to the data to write | ||
262 | * @param len the number of bytes to write | ||
263 | */ | ||
264 | void w1_touch_block(struct w1_master *dev, u8 *buf, int len) | ||
265 | { | ||
266 | int i, j; | ||
267 | u8 tmp; | ||
268 | |||
269 | for (i = 0; i < len; ++i) { | ||
270 | tmp = 0; | ||
271 | for (j = 0; j < 8; ++j) { | ||
272 | if (j == 7) | ||
273 | w1_pre_write(dev); | ||
274 | tmp |= w1_touch_bit(dev, (buf[i] >> j) & 0x1) << j; | ||
275 | } | ||
276 | |||
277 | buf[i] = tmp; | ||
278 | } | ||
279 | } | ||
280 | EXPORT_SYMBOL_GPL(w1_touch_block); | ||
281 | |||
282 | /** | ||
259 | * Reads a series of bytes. | 283 | * Reads a series of bytes. |
260 | * | 284 | * |
261 | * @param dev the master device | 285 | * @param dev the master device |
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c index 2e07b59b9859..cae556c8577b 100644 --- a/drivers/w1/w1_netlink.c +++ b/drivers/w1/w1_netlink.c | |||
@@ -108,6 +108,10 @@ static int w1_process_command_slave(struct w1_slave *sl, struct cn_msg *msg, | |||
108 | cmd->cmd, cmd->len); | 108 | cmd->cmd, cmd->len); |
109 | 109 | ||
110 | switch (cmd->cmd) { | 110 | switch (cmd->cmd) { |
111 | case W1_CMD_TOUCH: | ||
112 | w1_touch_block(sl->master, cmd->data, cmd->len); | ||
113 | w1_send_read_reply(sl, msg, hdr, cmd); | ||
114 | break; | ||
111 | case W1_CMD_READ: | 115 | case W1_CMD_READ: |
112 | w1_read_block(sl->master, cmd->data, cmd->len); | 116 | w1_read_block(sl->master, cmd->data, cmd->len); |
113 | w1_send_read_reply(sl, msg, hdr, cmd); | 117 | w1_send_read_reply(sl, msg, hdr, cmd); |
@@ -208,9 +212,6 @@ static void w1_cn_callback(void *data) | |||
208 | break; | 212 | break; |
209 | } | 213 | } |
210 | 214 | ||
211 | if (!mlen) | ||
212 | goto out_cont; | ||
213 | |||
214 | if (m->type == W1_MASTER_CMD) { | 215 | if (m->type == W1_MASTER_CMD) { |
215 | dev = w1_search_master_id(m->id.mst.id); | 216 | dev = w1_search_master_id(m->id.mst.id); |
216 | } else if (m->type == W1_SLAVE_CMD) { | 217 | } else if (m->type == W1_SLAVE_CMD) { |
@@ -227,6 +228,10 @@ static void w1_cn_callback(void *data) | |||
227 | goto out_cont; | 228 | goto out_cont; |
228 | } | 229 | } |
229 | 230 | ||
231 | err = 0; | ||
232 | if (!mlen) | ||
233 | goto out_cont; | ||
234 | |||
230 | mutex_lock(&dev->mutex); | 235 | mutex_lock(&dev->mutex); |
231 | 236 | ||
232 | if (sl && w1_reset_select_slave(sl)) { | 237 | if (sl && w1_reset_select_slave(sl)) { |
diff --git a/drivers/w1/w1_netlink.h b/drivers/w1/w1_netlink.h index 21913dfc0f3a..99dd21ba14c6 100644 --- a/drivers/w1/w1_netlink.h +++ b/drivers/w1/w1_netlink.h | |||
@@ -56,6 +56,7 @@ struct w1_netlink_msg | |||
56 | #define W1_CMD_WRITE 0x1 | 56 | #define W1_CMD_WRITE 0x1 |
57 | #define W1_CMD_SEARCH 0x2 | 57 | #define W1_CMD_SEARCH 0x2 |
58 | #define W1_CMD_ALARM_SEARCH 0x3 | 58 | #define W1_CMD_ALARM_SEARCH 0x3 |
59 | #define W1_CMD_TOUCH 0x4 | ||
59 | 60 | ||
60 | struct w1_netlink_cmd | 61 | struct w1_netlink_cmd |
61 | { | 62 | { |