Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'w1-drv-6.14' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/krzk/linux-w1 into char-misc-next

Krzysztof writes:

1-Wire bus drivers for v6.14

1. ds2482: Add support for handling the VCC regulator supply and three
more minor improvements/cleanups.

2. Constify 'struct bin_attribute' in all drivers.

3. W1 core: use sysfs_emit() instead of sprintf(), as preferred coding
style.

* tag 'w1-drv-6.14' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/krzk/linux-w1:
w1: core: use sysfs_emit() instead of sprintf()
w1: ds28e04: Constify 'struct bin_attribute'
w1: ds2805: Constify 'struct bin_attribute'
w1: ds2781: Constify 'struct bin_attribute'
w1: ds2780: Constify 'struct bin_attribute'
w1: ds2438: Constify 'struct bin_attribute'
w1: ds2433: Constify 'struct bin_attribute'
w1: ds2431: Constify 'struct bin_attribute'
w1: ds2430: Constify 'struct bin_attribute'
w1: ds2413: Constify 'struct bin_attribute'
w1: ds2408: Constify 'struct bin_attribute'
w1: ds2406: Constify 'struct bin_attribute'
w1: Constify 'struct bin_attribute'
w1: ds2482: Fix datasheet URL
w1: ds2482: Add regulator support
w1: ds2482: switch to devm_kzalloc() from kzalloc()
dt-bindings: w1: ds2482: Add vcc-supply property

+116 -116
+2
Documentation/devicetree/bindings/w1/maxim,ds2482.yaml
··· 25 25 reg: 26 26 maxItems: 1 27 27 28 + vcc-supply: true 29 + 28 30 required: 29 31 - compatible 30 32 - reg
+12 -14
drivers/w1/masters/ds2482.c
··· 7 7 * It is a I2C to 1-wire bridge. 8 8 * There are two variations: -100 and -800, which have 1 or 8 1-wire ports. 9 9 * The complete datasheet can be obtained from MAXIM's website at: 10 - * http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4382 10 + * https://www.analog.com/en/products/ds2482-100.html 11 11 */ 12 12 13 13 #include <linux/module.h> ··· 15 15 #include <linux/slab.h> 16 16 #include <linux/i2c.h> 17 17 #include <linux/delay.h> 18 + #include <linux/regulator/consumer.h> 18 19 19 20 #include <linux/w1.h> 20 21 ··· 446 445 int err = -ENODEV; 447 446 int temp1; 448 447 int idx; 448 + int ret; 449 449 450 450 if (!i2c_check_functionality(client->adapter, 451 451 I2C_FUNC_SMBUS_WRITE_BYTE_DATA | 452 452 I2C_FUNC_SMBUS_BYTE)) 453 453 return -ENODEV; 454 454 455 - data = kzalloc(sizeof(struct ds2482_data), GFP_KERNEL); 456 - if (!data) { 457 - err = -ENOMEM; 458 - goto exit; 459 - } 455 + data = devm_kzalloc(&client->dev, sizeof(struct ds2482_data), GFP_KERNEL); 456 + if (!data) 457 + return -ENOMEM; 458 + 459 + ret = devm_regulator_get_enable(&client->dev, "vcc"); 460 + if (ret) 461 + return dev_err_probe(&client->dev, ret, "Failed to enable regulator\n"); 460 462 461 463 data->client = client; 462 464 i2c_set_clientdata(client, data); ··· 467 463 /* Reset the device (sets the read_ptr to status) */ 468 464 if (ds2482_send_cmd(data, DS2482_CMD_RESET) < 0) { 469 465 dev_warn(&client->dev, "DS2482 reset failed.\n"); 470 - goto exit_free; 466 + return err; 471 467 } 472 468 473 469 /* Sleep at least 525ns to allow the reset to complete */ ··· 478 474 if (temp1 != (DS2482_REG_STS_LL | DS2482_REG_STS_RST)) { 479 475 dev_warn(&client->dev, "DS2482 reset status " 480 476 "0x%02X - not a DS2482\n", temp1); 481 - goto exit_free; 477 + return err; 482 478 } 483 479 484 480 /* Detect the 8-port version */ ··· 520 516 if (data->w1_ch[idx].pdev != NULL) 521 517 w1_remove_master_device(&data->w1_ch[idx].w1_bm); 522 518 } 523 - exit_free: 524 - kfree(data); 525 - exit: 526 519 return err; 527 520 } 528 521 ··· 533 532 if (data->w1_ch[idx].pdev != NULL) 534 533 w1_remove_master_device(&data->w1_ch[idx].w1_bm); 535 534 } 536 - 537 - /* Free the memory */ 538 - kfree(data); 539 535 } 540 536 541 537 /*
+5 -5
drivers/w1/slaves/w1_ds2406.c
··· 24 24 25 25 static ssize_t w1_f12_read_state( 26 26 struct file *filp, struct kobject *kobj, 27 - struct bin_attribute *bin_attr, 27 + const struct bin_attribute *bin_attr, 28 28 char *buf, loff_t off, size_t count) 29 29 { 30 30 u8 w1_buf[6] = {W1_F12_FUNC_READ_STATUS, 7, 0, 0, 0, 0}; ··· 61 61 62 62 static ssize_t w1_f12_write_output( 63 63 struct file *filp, struct kobject *kobj, 64 - struct bin_attribute *bin_attr, 64 + const struct bin_attribute *bin_attr, 65 65 char *buf, loff_t off, size_t count) 66 66 { 67 67 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 95 95 } 96 96 97 97 #define NB_SYSFS_BIN_FILES 2 98 - static struct bin_attribute w1_f12_sysfs_bin_files[NB_SYSFS_BIN_FILES] = { 98 + static const struct bin_attribute w1_f12_sysfs_bin_files[NB_SYSFS_BIN_FILES] = { 99 99 { 100 100 .attr = { 101 101 .name = "state", 102 102 .mode = 0444, 103 103 }, 104 104 .size = 1, 105 - .read = w1_f12_read_state, 105 + .read_new = w1_f12_read_state, 106 106 }, 107 107 { 108 108 .attr = { ··· 110 110 .mode = 0664, 111 111 }, 112 112 .size = 1, 113 - .write = w1_f12_write_output, 113 + .write_new = w1_f12_write_output, 114 114 } 115 115 }; 116 116
+21 -21
drivers/w1/slaves/w1_ds2408.c
··· 65 65 } 66 66 67 67 static ssize_t state_read(struct file *filp, struct kobject *kobj, 68 - struct bin_attribute *bin_attr, char *buf, loff_t off, 69 - size_t count) 68 + const struct bin_attribute *bin_attr, char *buf, 69 + loff_t off, size_t count) 70 70 { 71 71 dev_dbg(&kobj_to_w1_slave(kobj)->dev, 72 72 "Reading %s kobj: %p, off: %0#10x, count: %zu, buff addr: %p", ··· 77 77 } 78 78 79 79 static ssize_t output_read(struct file *filp, struct kobject *kobj, 80 - struct bin_attribute *bin_attr, char *buf, 80 + const struct bin_attribute *bin_attr, char *buf, 81 81 loff_t off, size_t count) 82 82 { 83 83 dev_dbg(&kobj_to_w1_slave(kobj)->dev, ··· 90 90 } 91 91 92 92 static ssize_t activity_read(struct file *filp, struct kobject *kobj, 93 - struct bin_attribute *bin_attr, char *buf, 93 + const struct bin_attribute *bin_attr, char *buf, 94 94 loff_t off, size_t count) 95 95 { 96 96 dev_dbg(&kobj_to_w1_slave(kobj)->dev, ··· 103 103 } 104 104 105 105 static ssize_t cond_search_mask_read(struct file *filp, struct kobject *kobj, 106 - struct bin_attribute *bin_attr, char *buf, 107 - loff_t off, size_t count) 106 + const struct bin_attribute *bin_attr, 107 + char *buf, loff_t off, size_t count) 108 108 { 109 109 dev_dbg(&kobj_to_w1_slave(kobj)->dev, 110 110 "Reading %s kobj: %p, off: %0#10x, count: %zu, buff addr: %p", ··· 117 117 118 118 static ssize_t cond_search_polarity_read(struct file *filp, 119 119 struct kobject *kobj, 120 - struct bin_attribute *bin_attr, 120 + const struct bin_attribute *bin_attr, 121 121 char *buf, loff_t off, size_t count) 122 122 { 123 123 if (count != 1 || off != 0) ··· 127 127 } 128 128 129 129 static ssize_t status_control_read(struct file *filp, struct kobject *kobj, 130 - struct bin_attribute *bin_attr, char *buf, 131 - loff_t off, size_t count) 130 + const struct bin_attribute *bin_attr, 131 + char *buf, loff_t off, size_t count) 132 132 { 133 133 if (count != 1 || off != 0) 134 134 return -EFAULT; ··· 160 160 #endif 161 161 162 162 static ssize_t output_write(struct file *filp, struct kobject *kobj, 163 - struct bin_attribute *bin_attr, char *buf, 163 + const struct bin_attribute *bin_attr, char *buf, 164 164 loff_t off, size_t count) 165 165 { 166 166 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 210 210 * Writing to the activity file resets the activity latches. 211 211 */ 212 212 static ssize_t activity_write(struct file *filp, struct kobject *kobj, 213 - struct bin_attribute *bin_attr, char *buf, 213 + const struct bin_attribute *bin_attr, char *buf, 214 214 loff_t off, size_t count) 215 215 { 216 216 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 240 240 } 241 241 242 242 static ssize_t status_control_write(struct file *filp, struct kobject *kobj, 243 - struct bin_attribute *bin_attr, char *buf, 244 - loff_t off, size_t count) 243 + const struct bin_attribute *bin_attr, 244 + char *buf, loff_t off, size_t count) 245 245 { 246 246 struct w1_slave *sl = kobj_to_w1_slave(kobj); 247 247 u8 w1_buf[4]; ··· 310 310 return res; 311 311 } 312 312 313 - static BIN_ATTR_RO(state, 1); 314 - static BIN_ATTR_RW(output, 1); 315 - static BIN_ATTR_RW(activity, 1); 316 - static BIN_ATTR_RO(cond_search_mask, 1); 317 - static BIN_ATTR_RO(cond_search_polarity, 1); 318 - static BIN_ATTR_RW(status_control, 1); 313 + static const BIN_ATTR_RO(state, 1); 314 + static const BIN_ATTR_RW(output, 1); 315 + static const BIN_ATTR_RW(activity, 1); 316 + static const BIN_ATTR_RO(cond_search_mask, 1); 317 + static const BIN_ATTR_RO(cond_search_polarity, 1); 318 + static const BIN_ATTR_RW(status_control, 1); 319 319 320 - static struct bin_attribute *w1_f29_bin_attrs[] = { 320 + static const struct bin_attribute *const w1_f29_bin_attrs[] = { 321 321 &bin_attr_state, 322 322 &bin_attr_output, 323 323 &bin_attr_activity, ··· 328 328 }; 329 329 330 330 static const struct attribute_group w1_f29_group = { 331 - .bin_attrs = w1_f29_bin_attrs, 331 + .bin_attrs_new = w1_f29_bin_attrs, 332 332 }; 333 333 334 334 static const struct attribute_group *w1_f29_groups[] = {
+7 -7
drivers/w1/slaves/w1_ds2413.c
··· 25 25 #define W1_F3A_INVALID_PIO_STATE 0xFF 26 26 27 27 static ssize_t state_read(struct file *filp, struct kobject *kobj, 28 - struct bin_attribute *bin_attr, char *buf, loff_t off, 29 - size_t count) 28 + const struct bin_attribute *bin_attr, char *buf, 29 + loff_t off, size_t count) 30 30 { 31 31 struct w1_slave *sl = kobj_to_w1_slave(kobj); 32 32 unsigned int retries = W1_F3A_RETRIES; ··· 78 78 return bytes_read; 79 79 } 80 80 81 - static BIN_ATTR_RO(state, 1); 81 + static const BIN_ATTR_RO(state, 1); 82 82 83 83 static ssize_t output_write(struct file *filp, struct kobject *kobj, 84 - struct bin_attribute *bin_attr, char *buf, 84 + const struct bin_attribute *bin_attr, char *buf, 85 85 loff_t off, size_t count) 86 86 { 87 87 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 128 128 return bytes_written; 129 129 } 130 130 131 - static BIN_ATTR(output, 0664, NULL, output_write, 1); 131 + static const BIN_ATTR(output, 0664, NULL, output_write, 1); 132 132 133 - static struct bin_attribute *w1_f3a_bin_attrs[] = { 133 + static const struct bin_attribute *const w1_f3a_bin_attrs[] = { 134 134 &bin_attr_state, 135 135 &bin_attr_output, 136 136 NULL, 137 137 }; 138 138 139 139 static const struct attribute_group w1_f3a_group = { 140 - .bin_attrs = w1_f3a_bin_attrs, 140 + .bin_attrs_new = w1_f3a_bin_attrs, 141 141 }; 142 142 143 143 static const struct attribute_group *w1_f3a_groups[] = {
+5 -5
drivers/w1/slaves/w1_ds2430.c
··· 95 95 } 96 96 97 97 static ssize_t eeprom_read(struct file *filp, struct kobject *kobj, 98 - struct bin_attribute *bin_attr, char *buf, 98 + const struct bin_attribute *bin_attr, char *buf, 99 99 loff_t off, size_t count) 100 100 { 101 101 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 202 202 } 203 203 204 204 static ssize_t eeprom_write(struct file *filp, struct kobject *kobj, 205 - struct bin_attribute *bin_attr, char *buf, 205 + const struct bin_attribute *bin_attr, char *buf, 206 206 loff_t off, size_t count) 207 207 { 208 208 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 263 263 return count; 264 264 } 265 265 266 - static BIN_ATTR_RW(eeprom, W1_F14_EEPROM_SIZE); 266 + static const BIN_ATTR_RW(eeprom, W1_F14_EEPROM_SIZE); 267 267 268 - static struct bin_attribute *w1_f14_bin_attrs[] = { 268 + static const struct bin_attribute *const w1_f14_bin_attrs[] = { 269 269 &bin_attr_eeprom, 270 270 NULL, 271 271 }; 272 272 273 273 static const struct attribute_group w1_f14_group = { 274 - .bin_attrs = w1_f14_bin_attrs, 274 + .bin_attrs_new = w1_f14_bin_attrs, 275 275 }; 276 276 277 277 static const struct attribute_group *w1_f14_groups[] = {
+5 -5
drivers/w1/slaves/w1_ds2431.c
··· 95 95 } 96 96 97 97 static ssize_t eeprom_read(struct file *filp, struct kobject *kobj, 98 - struct bin_attribute *bin_attr, char *buf, 98 + const struct bin_attribute *bin_attr, char *buf, 99 99 loff_t off, size_t count) 100 100 { 101 101 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 201 201 } 202 202 203 203 static ssize_t eeprom_write(struct file *filp, struct kobject *kobj, 204 - struct bin_attribute *bin_attr, char *buf, 204 + const struct bin_attribute *bin_attr, char *buf, 205 205 loff_t off, size_t count) 206 206 { 207 207 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 262 262 return count; 263 263 } 264 264 265 - static BIN_ATTR_RW(eeprom, W1_F2D_EEPROM_SIZE); 265 + static const BIN_ATTR_RW(eeprom, W1_F2D_EEPROM_SIZE); 266 266 267 - static struct bin_attribute *w1_f2d_bin_attrs[] = { 267 + static const struct bin_attribute *const w1_f2d_bin_attrs[] = { 268 268 &bin_attr_eeprom, 269 269 NULL, 270 270 }; 271 271 272 272 static const struct attribute_group w1_f2d_group = { 273 - .bin_attrs = w1_f2d_bin_attrs, 273 + .bin_attrs_new = w1_f2d_bin_attrs, 274 274 }; 275 275 276 276 static const struct attribute_group *w1_f2d_groups[] = {
+12 -12
drivers/w1/slaves/w1_ds2433.c
··· 110 110 #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ 111 111 112 112 static ssize_t eeprom_read(struct file *filp, struct kobject *kobj, 113 - struct bin_attribute *bin_attr, char *buf, 113 + const struct bin_attribute *bin_attr, char *buf, 114 114 loff_t off, size_t count) 115 115 { 116 116 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 224 224 } 225 225 226 226 static ssize_t eeprom_write(struct file *filp, struct kobject *kobj, 227 - struct bin_attribute *bin_attr, char *buf, 227 + const struct bin_attribute *bin_attr, char *buf, 228 228 loff_t off, size_t count) 229 229 { 230 230 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 274 274 return count; 275 275 } 276 276 277 - static struct bin_attribute bin_attr_f23_eeprom = { 277 + static const struct bin_attribute bin_attr_f23_eeprom = { 278 278 .attr = { .name = "eeprom", .mode = 0644 }, 279 - .read = eeprom_read, 280 - .write = eeprom_write, 279 + .read_new = eeprom_read, 280 + .write_new = eeprom_write, 281 281 .size = W1_EEPROM_DS2433_SIZE, 282 282 }; 283 283 284 - static struct bin_attribute bin_attr_f43_eeprom = { 284 + static const struct bin_attribute bin_attr_f43_eeprom = { 285 285 .attr = { .name = "eeprom", .mode = 0644 }, 286 - .read = eeprom_read, 287 - .write = eeprom_write, 286 + .read_new = eeprom_read, 287 + .write_new = eeprom_write, 288 288 .size = W1_EEPROM_DS28EC20_SIZE, 289 289 }; 290 290 291 - static struct bin_attribute *w1_f23_bin_attributes[] = { 291 + static const struct bin_attribute *const w1_f23_bin_attributes[] = { 292 292 &bin_attr_f23_eeprom, 293 293 NULL, 294 294 }; 295 295 296 296 static const struct attribute_group w1_f23_group = { 297 - .bin_attrs = w1_f23_bin_attributes, 297 + .bin_attrs_new = w1_f23_bin_attributes, 298 298 }; 299 299 300 300 static const struct attribute_group *w1_f23_groups[] = { ··· 302 302 NULL, 303 303 }; 304 304 305 - static struct bin_attribute *w1_f43_bin_attributes[] = { 305 + static const struct bin_attribute *const w1_f43_bin_attributes[] = { 306 306 &bin_attr_f43_eeprom, 307 307 NULL, 308 308 }; 309 309 310 310 static const struct attribute_group w1_f43_group = { 311 - .bin_attrs = w1_f43_bin_attributes, 311 + .bin_attrs_new = w1_f43_bin_attributes, 312 312 }; 313 313 314 314 static const struct attribute_group *w1_f43_groups[] = {
+17 -17
drivers/w1/slaves/w1_ds2438.c
··· 288 288 } 289 289 290 290 static ssize_t iad_write(struct file *filp, struct kobject *kobj, 291 - struct bin_attribute *bin_attr, char *buf, 291 + const struct bin_attribute *bin_attr, char *buf, 292 292 loff_t off, size_t count) 293 293 { 294 294 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 310 310 } 311 311 312 312 static ssize_t iad_read(struct file *filp, struct kobject *kobj, 313 - struct bin_attribute *bin_attr, char *buf, 313 + const struct bin_attribute *bin_attr, char *buf, 314 314 loff_t off, size_t count) 315 315 { 316 316 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 331 331 } 332 332 333 333 static ssize_t page0_read(struct file *filp, struct kobject *kobj, 334 - struct bin_attribute *bin_attr, char *buf, 334 + const struct bin_attribute *bin_attr, char *buf, 335 335 loff_t off, size_t count) 336 336 { 337 337 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 361 361 } 362 362 363 363 static ssize_t page1_read(struct file *filp, struct kobject *kobj, 364 - struct bin_attribute *bin_attr, char *buf, 364 + const struct bin_attribute *bin_attr, char *buf, 365 365 loff_t off, size_t count) 366 366 { 367 367 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 391 391 } 392 392 393 393 static ssize_t offset_write(struct file *filp, struct kobject *kobj, 394 - struct bin_attribute *bin_attr, char *buf, 394 + const struct bin_attribute *bin_attr, char *buf, 395 395 loff_t off, size_t count) 396 396 { 397 397 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 410 410 } 411 411 412 412 static ssize_t temperature_read(struct file *filp, struct kobject *kobj, 413 - struct bin_attribute *bin_attr, char *buf, 413 + const struct bin_attribute *bin_attr, char *buf, 414 414 loff_t off, size_t count) 415 415 { 416 416 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 431 431 } 432 432 433 433 static ssize_t vad_read(struct file *filp, struct kobject *kobj, 434 - struct bin_attribute *bin_attr, char *buf, 434 + const struct bin_attribute *bin_attr, char *buf, 435 435 loff_t off, size_t count) 436 436 { 437 437 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 452 452 } 453 453 454 454 static ssize_t vdd_read(struct file *filp, struct kobject *kobj, 455 - struct bin_attribute *bin_attr, char *buf, 455 + const struct bin_attribute *bin_attr, char *buf, 456 456 loff_t off, size_t count) 457 457 { 458 458 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 472 472 return ret; 473 473 } 474 474 475 - static BIN_ATTR_RW(iad, 0); 476 - static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); 477 - static BIN_ATTR_RO(page1, DS2438_PAGE_SIZE); 478 - static BIN_ATTR_WO(offset, 2); 479 - static BIN_ATTR_RO(temperature, 0/* real length varies */); 480 - static BIN_ATTR_RO(vad, 0/* real length varies */); 481 - static BIN_ATTR_RO(vdd, 0/* real length varies */); 475 + static const BIN_ATTR_RW(iad, 0); 476 + static const BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); 477 + static const BIN_ATTR_RO(page1, DS2438_PAGE_SIZE); 478 + static const BIN_ATTR_WO(offset, 2); 479 + static const BIN_ATTR_RO(temperature, 0/* real length varies */); 480 + static const BIN_ATTR_RO(vad, 0/* real length varies */); 481 + static const BIN_ATTR_RO(vdd, 0/* real length varies */); 482 482 483 - static struct bin_attribute *w1_ds2438_bin_attrs[] = { 483 + static const struct bin_attribute *const w1_ds2438_bin_attrs[] = { 484 484 &bin_attr_iad, 485 485 &bin_attr_page0, 486 486 &bin_attr_page1, ··· 492 492 }; 493 493 494 494 static const struct attribute_group w1_ds2438_group = { 495 - .bin_attrs = w1_ds2438_bin_attrs, 495 + .bin_attrs_new = w1_ds2438_bin_attrs, 496 496 }; 497 497 498 498 static const struct attribute_group *w1_ds2438_groups[] = {
+4 -4
drivers/w1/slaves/w1_ds2780.c
··· 87 87 EXPORT_SYMBOL(w1_ds2780_eeprom_cmd); 88 88 89 89 static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj, 90 - struct bin_attribute *bin_attr, char *buf, 90 + const struct bin_attribute *bin_attr, char *buf, 91 91 loff_t off, size_t count) 92 92 { 93 93 struct device *dev = kobj_to_dev(kobj); ··· 95 95 return w1_ds2780_io(dev, buf, off, count, 0); 96 96 } 97 97 98 - static BIN_ATTR_RO(w1_slave, DS2780_DATA_SIZE); 98 + static const BIN_ATTR_RO(w1_slave, DS2780_DATA_SIZE); 99 99 100 - static struct bin_attribute *w1_ds2780_bin_attrs[] = { 100 + static const struct bin_attribute *const w1_ds2780_bin_attrs[] = { 101 101 &bin_attr_w1_slave, 102 102 NULL, 103 103 }; 104 104 105 105 static const struct attribute_group w1_ds2780_group = { 106 - .bin_attrs = w1_ds2780_bin_attrs, 106 + .bin_attrs_new = w1_ds2780_bin_attrs, 107 107 }; 108 108 109 109 static const struct attribute_group *w1_ds2780_groups[] = {
+4 -4
drivers/w1/slaves/w1_ds2781.c
··· 84 84 EXPORT_SYMBOL(w1_ds2781_eeprom_cmd); 85 85 86 86 static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj, 87 - struct bin_attribute *bin_attr, char *buf, 87 + const struct bin_attribute *bin_attr, char *buf, 88 88 loff_t off, size_t count) 89 89 { 90 90 struct device *dev = kobj_to_dev(kobj); ··· 92 92 return w1_ds2781_io(dev, buf, off, count, 0); 93 93 } 94 94 95 - static BIN_ATTR_RO(w1_slave, DS2781_DATA_SIZE); 95 + static const BIN_ATTR_RO(w1_slave, DS2781_DATA_SIZE); 96 96 97 - static struct bin_attribute *w1_ds2781_bin_attrs[] = { 97 + static const struct bin_attribute *const w1_ds2781_bin_attrs[] = { 98 98 &bin_attr_w1_slave, 99 99 NULL, 100 100 }; 101 101 102 102 static const struct attribute_group w1_ds2781_group = { 103 - .bin_attrs = w1_ds2781_bin_attrs, 103 + .bin_attrs_new = w1_ds2781_bin_attrs, 104 104 }; 105 105 106 106 static const struct attribute_group *w1_ds2781_groups[] = {
+5 -5
drivers/w1/slaves/w1_ds2805.c
··· 92 92 } 93 93 94 94 static ssize_t w1_f0d_read_bin(struct file *filp, struct kobject *kobj, 95 - struct bin_attribute *bin_attr, 95 + const struct bin_attribute *bin_attr, 96 96 char *buf, loff_t off, size_t count) 97 97 { 98 98 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 200 200 } 201 201 202 202 static ssize_t w1_f0d_write_bin(struct file *filp, struct kobject *kobj, 203 - struct bin_attribute *bin_attr, 203 + const struct bin_attribute *bin_attr, 204 204 char *buf, loff_t off, size_t count) 205 205 { 206 206 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 261 261 return count; 262 262 } 263 263 264 - static struct bin_attribute w1_f0d_bin_attr = { 264 + static const struct bin_attribute w1_f0d_bin_attr = { 265 265 .attr = { 266 266 .name = "eeprom", 267 267 .mode = 0644, 268 268 }, 269 269 .size = W1_F0D_EEPROM_SIZE, 270 - .read = w1_f0d_read_bin, 271 - .write = w1_f0d_write_bin, 270 + .read_new = w1_f0d_read_bin, 271 + .write_new = w1_f0d_write_bin, 272 272 }; 273 273 274 274 static int w1_f0d_add_slave(struct w1_slave *sl)
+9 -9
drivers/w1/slaves/w1_ds28e04.c
··· 112 112 } 113 113 114 114 static ssize_t eeprom_read(struct file *filp, struct kobject *kobj, 115 - struct bin_attribute *bin_attr, char *buf, 115 + const struct bin_attribute *bin_attr, char *buf, 116 116 loff_t off, size_t count) 117 117 { 118 118 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 223 223 } 224 224 225 225 static ssize_t eeprom_write(struct file *filp, struct kobject *kobj, 226 - struct bin_attribute *bin_attr, char *buf, 226 + const struct bin_attribute *bin_attr, char *buf, 227 227 loff_t off, size_t count) 228 228 229 229 { ··· 276 276 return count; 277 277 } 278 278 279 - static BIN_ATTR_RW(eeprom, W1_EEPROM_SIZE); 279 + static const BIN_ATTR_RW(eeprom, W1_EEPROM_SIZE); 280 280 281 281 static ssize_t pio_read(struct file *filp, struct kobject *kobj, 282 - struct bin_attribute *bin_attr, char *buf, loff_t off, 282 + const struct bin_attribute *bin_attr, char *buf, loff_t off, 283 283 size_t count) 284 284 285 285 { ··· 298 298 } 299 299 300 300 static ssize_t pio_write(struct file *filp, struct kobject *kobj, 301 - struct bin_attribute *bin_attr, char *buf, loff_t off, 302 - size_t count) 301 + const struct bin_attribute *bin_attr, char *buf, 302 + loff_t off, size_t count) 303 303 304 304 { 305 305 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 337 337 return count; 338 338 } 339 339 340 - static BIN_ATTR_RW(pio, 1); 340 + static const BIN_ATTR_RW(pio, 1); 341 341 342 342 static ssize_t crccheck_show(struct device *dev, struct device_attribute *attr, 343 343 char *buf) ··· 363 363 NULL, 364 364 }; 365 365 366 - static struct bin_attribute *w1_f1C_bin_attrs[] = { 366 + static const struct bin_attribute *const w1_f1C_bin_attrs[] = { 367 367 &bin_attr_eeprom, 368 368 &bin_attr_pio, 369 369 NULL, ··· 371 371 372 372 static const struct attribute_group w1_f1C_group = { 373 373 .attrs = w1_f1C_attrs, 374 - .bin_attrs = w1_f1C_bin_attrs, 374 + .bin_attrs_new = w1_f1C_bin_attrs, 375 375 }; 376 376 377 377 static const struct attribute_group *w1_f1C_groups[] = {
+2 -2
drivers/w1/slaves/w1_ds28e17.c
··· 583 583 return result; 584 584 585 585 /* Return current speed value. */ 586 - return sprintf(buf, "%d\n", result); 586 + return sysfs_emit(buf, "%d\n", result); 587 587 } 588 588 589 589 static ssize_t speed_store(struct device *dev, struct device_attribute *attr, ··· 633 633 struct w1_f19_data *data = sl->family_data; 634 634 635 635 /* Return current stretch value. */ 636 - return sprintf(buf, "%d\n", data->stretch); 636 + return sysfs_emit(buf, "%d\n", data->stretch); 637 637 } 638 638 639 639 static ssize_t stretch_store(struct device *dev, struct device_attribute *attr,
+6 -6
drivers/w1/w1.c
··· 111 111 /* Default family */ 112 112 113 113 static ssize_t rw_write(struct file *filp, struct kobject *kobj, 114 - struct bin_attribute *bin_attr, char *buf, loff_t off, 114 + const struct bin_attribute *bin_attr, char *buf, loff_t off, 115 115 size_t count) 116 116 { 117 117 struct w1_slave *sl = kobj_to_w1_slave(kobj); ··· 130 130 } 131 131 132 132 static ssize_t rw_read(struct file *filp, struct kobject *kobj, 133 - struct bin_attribute *bin_attr, char *buf, loff_t off, 134 - size_t count) 133 + const struct bin_attribute *bin_attr, char *buf, 134 + loff_t off, size_t count) 135 135 { 136 136 struct w1_slave *sl = kobj_to_w1_slave(kobj); 137 137 ··· 141 141 return count; 142 142 } 143 143 144 - static BIN_ATTR_RW(rw, PAGE_SIZE); 144 + static const BIN_ATTR_RW(rw, PAGE_SIZE); 145 145 146 - static struct bin_attribute *w1_slave_bin_attrs[] = { 146 + static const struct bin_attribute *const w1_slave_bin_attrs[] = { 147 147 &bin_attr_rw, 148 148 NULL, 149 149 }; 150 150 151 151 static const struct attribute_group w1_slave_default_group = { 152 - .bin_attrs = w1_slave_bin_attrs, 152 + .bin_attrs_new = w1_slave_bin_attrs, 153 153 }; 154 154 155 155 static const struct attribute_group *w1_slave_default_groups[] = {