Skip to content

Commit fe15146

Browse files
committed
Merge tag 'driver-core-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg KH: "Here is the "big" set of driver core patches for 5.10-rc1 They include a lot of different things, all related to the driver core and/or some driver logic: - sysfs common write functions to make it easier to audit sysfs attributes - device connection cleanups and fixes - devm helpers for a few functions - NOIO allocations for when devices are being removed - minor cleanups and fixes All have been in linux-next for a while with no reported issues" * tag 'driver-core-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (31 commits) regmap: debugfs: use semicolons rather than commas to separate statements platform/x86: intel_pmc_core: do not create a static struct device drivers core: node: Use a more typical macro definition style for ACCESS_ATTR drivers core: Use sysfs_emit for shared_cpu_map_show and shared_cpu_list_show mm: and drivers core: Convert hugetlb_report_node_meminfo to sysfs_emit drivers core: Miscellaneous changes for sysfs_emit drivers core: Reindent a couple uses around sysfs_emit drivers core: Remove strcat uses around sysfs_emit and neaten drivers core: Use sysfs_emit and sysfs_emit_at for show(device *...) functions sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output dyndbg: use keyword, arg varnames for query term pairs driver core: force NOIO allocations during unplug platform_device: switch to simpler IDA interface driver core: platform: Document return type of more functions Revert "driver core: Annotate dev_err_probe() with __must_check" Revert "test_firmware: Test platform fw loading on non-EFI systems" iio: adc: xilinx-xadc: use devm_krealloc() hwmon: pmbus: use more devres helpers devres: provide devm_krealloc() syscore: Use pm_pr_dbg() for syscore_{suspend,resume}() ...
2 parents 5d6c413 + ee49067 commit fe15146

40 files changed

+1135
-817
lines changed

Documentation/driver-api/device_connection.rst

Lines changed: 0 additions & 43 deletions
This file was deleted.

Documentation/driver-api/driver-model/devres.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ MEM
354354
devm_kmalloc()
355355
devm_kmalloc_array()
356356
devm_kmemdup()
357+
devm_krealloc()
357358
devm_kstrdup()
358359
devm_kvasprintf()
359360
devm_kzalloc()

Documentation/driver-api/firmware/fallback-mechanisms.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ fallback mechanism:
4242
supported for request_firmware_into_buf().
4343

4444
* Firmware is not accessible through typical means:
45+
4546
* It cannot be installed into the root filesystem
4647
* The firmware provides very unique device specific data tailored for
4748
the unit gathered with local information. An example is calibration

Documentation/driver-api/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ available subsections can be seen below.
2222
pm/index
2323
clk
2424
device-io
25-
device_connection
2625
dma-buf
2726
device_link
2827
component

Documentation/filesystems/sysfs.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,10 @@ Other notes:
241241
is 4096.
242242

243243
- show() methods should return the number of bytes printed into the
244-
buffer. This is the return value of scnprintf().
244+
buffer.
245245

246-
- show() must not use snprintf() when formatting the value to be
247-
returned to user space. If you can guarantee that an overflow
248-
will never happen you can use sprintf() otherwise you must use
249-
scnprintf().
246+
- show() should only use sysfs_emit() or sysfs_emit_at() when formatting
247+
the value to be returned to user space.
250248

251249
- store() should return the number of bytes used from the buffer. If the
252250
entire buffer has been used, just return the count argument.

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5023,6 +5023,12 @@ S: Maintained
50235023
F: drivers/base/devcoredump.c
50245024
F: include/linux/devcoredump.h
50255025

5026+
DEVICE DEPENDENCY HELPER SCRIPT
5027+
M: Saravana Kannan <[email protected]>
5028+
5029+
S: Maintained
5030+
F: scripts/dev-needs.sh
5031+
50265032
DEVICE DIRECT ACCESS (DAX)
50275033
M: Dan Williams <[email protected]>
50285034
M: Vishal Verma <[email protected]>

drivers/base/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ obj-y := component.o core.o bus.o dd.o syscore.o \
66
cpu.o firmware.o init.o map.o devres.o \
77
attribute_container.o transport_class.o \
88
topology.o container.o property.o cacheinfo.o \
9-
devcon.o swnode.o
9+
swnode.o
1010
obj-$(CONFIG_DEVTMPFS) += devtmpfs.o
1111
obj-y += power/
1212
obj-$(CONFIG_ISA_BUS_API) += isa.o

drivers/base/arch_topology.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static ssize_t cpu_capacity_show(struct device *dev,
8080
{
8181
struct cpu *cpu = container_of(dev, struct cpu, dev);
8282

83-
return sprintf(buf, "%lu\n", topology_get_cpu_scale(cpu->dev.id));
83+
return sysfs_emit(buf, "%lu\n", topology_get_cpu_scale(cpu->dev.id));
8484
}
8585

8686
static void update_topology_flags_workfn(struct work_struct *work);

drivers/base/bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static DRIVER_ATTR_IGNORE_LOCKDEP(bind, S_IWUSR, NULL, bind_store);
229229

230230
static ssize_t drivers_autoprobe_show(struct bus_type *bus, char *buf)
231231
{
232-
return sprintf(buf, "%d\n", bus->p->drivers_autoprobe);
232+
return sysfs_emit(buf, "%d\n", bus->p->drivers_autoprobe);
233233
}
234234

235235
static ssize_t drivers_autoprobe_store(struct bus_type *bus,

drivers/base/cacheinfo.c

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ static ssize_t file_name##_show(struct device *dev, \
362362
struct device_attribute *attr, char *buf) \
363363
{ \
364364
struct cacheinfo *this_leaf = dev_get_drvdata(dev); \
365-
return sprintf(buf, "%u\n", this_leaf->object); \
365+
return sysfs_emit(buf, "%u\n", this_leaf->object); \
366366
}
367367

368368
show_one(id, id);
@@ -377,60 +377,67 @@ static ssize_t size_show(struct device *dev,
377377
{
378378
struct cacheinfo *this_leaf = dev_get_drvdata(dev);
379379

380-
return sprintf(buf, "%uK\n", this_leaf->size >> 10);
380+
return sysfs_emit(buf, "%uK\n", this_leaf->size >> 10);
381381
}
382382

383-
static ssize_t shared_cpumap_show_func(struct device *dev, bool list, char *buf)
383+
static ssize_t shared_cpu_map_show(struct device *dev,
384+
struct device_attribute *attr, char *buf)
384385
{
385386
struct cacheinfo *this_leaf = dev_get_drvdata(dev);
386387
const struct cpumask *mask = &this_leaf->shared_cpu_map;
387388

388-
return cpumap_print_to_pagebuf(list, buf, mask);
389-
}
390-
391-
static ssize_t shared_cpu_map_show(struct device *dev,
392-
struct device_attribute *attr, char *buf)
393-
{
394-
return shared_cpumap_show_func(dev, false, buf);
389+
return sysfs_emit(buf, "%*pb\n", nr_cpu_ids, mask);
395390
}
396391

397392
static ssize_t shared_cpu_list_show(struct device *dev,
398393
struct device_attribute *attr, char *buf)
399394
{
400-
return shared_cpumap_show_func(dev, true, buf);
395+
struct cacheinfo *this_leaf = dev_get_drvdata(dev);
396+
const struct cpumask *mask = &this_leaf->shared_cpu_map;
397+
398+
return sysfs_emit(buf, "%*pbl\n", nr_cpu_ids, mask);
401399
}
402400

403401
static ssize_t type_show(struct device *dev,
404402
struct device_attribute *attr, char *buf)
405403
{
406404
struct cacheinfo *this_leaf = dev_get_drvdata(dev);
405+
const char *output;
407406

408407
switch (this_leaf->type) {
409408
case CACHE_TYPE_DATA:
410-
return sprintf(buf, "Data\n");
409+
output = "Data";
410+
break;
411411
case CACHE_TYPE_INST:
412-
return sprintf(buf, "Instruction\n");
412+
output = "Instruction";
413+
break;
413414
case CACHE_TYPE_UNIFIED:
414-
return sprintf(buf, "Unified\n");
415+
output = "Unified";
416+
break;
415417
default:
416418
return -EINVAL;
417419
}
420+
421+
return sysfs_emit(buf, "%s\n", output);
418422
}
419423

420424
static ssize_t allocation_policy_show(struct device *dev,
421425
struct device_attribute *attr, char *buf)
422426
{
423427
struct cacheinfo *this_leaf = dev_get_drvdata(dev);
424428
unsigned int ci_attr = this_leaf->attributes;
425-
int n = 0;
429+
const char *output;
426430

427431
if ((ci_attr & CACHE_READ_ALLOCATE) && (ci_attr & CACHE_WRITE_ALLOCATE))
428-
n = sprintf(buf, "ReadWriteAllocate\n");
432+
output = "ReadWriteAllocate";
429433
else if (ci_attr & CACHE_READ_ALLOCATE)
430-
n = sprintf(buf, "ReadAllocate\n");
434+
output = "ReadAllocate";
431435
else if (ci_attr & CACHE_WRITE_ALLOCATE)
432-
n = sprintf(buf, "WriteAllocate\n");
433-
return n;
436+
output = "WriteAllocate";
437+
else
438+
return 0;
439+
440+
return sysfs_emit(buf, "%s\n", output);
434441
}
435442

436443
static ssize_t write_policy_show(struct device *dev,
@@ -441,9 +448,9 @@ static ssize_t write_policy_show(struct device *dev,
441448
int n = 0;
442449

443450
if (ci_attr & CACHE_WRITE_THROUGH)
444-
n = sprintf(buf, "WriteThrough\n");
451+
n = sysfs_emit(buf, "WriteThrough\n");
445452
else if (ci_attr & CACHE_WRITE_BACK)
446-
n = sprintf(buf, "WriteBack\n");
453+
n = sysfs_emit(buf, "WriteBack\n");
447454
return n;
448455
}
449456

0 commit comments

Comments
 (0)