Skip to content

Commit fc75f21

Browse files
committed
Merge tag 'driver-core-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg KH: "Here are a small set of changes for 6.5-rc1 for some driver core changes. Included in here are: - device property cleanups to make it easier to write "agnostic" drivers when regards to the firmware layer underneath them (DT vs. ACPI) - debugfs documentation updates - devres additions - sysfs documentation and changes to handle empty directory creation logic better - tiny kernfs optimizations - other tiny changes All of these have been in linux-next for a while with no reported problems" * tag 'driver-core-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: sysfs: Skip empty folders creation sysfs: Improve readability by following the kernel coding style drivers: fwnode: fix fwnode_irq_get[_byname]() ata: ahci_platform: Make code agnostic to OF/ACPI device property: Implement device_is_compatible() ACPI: Move ACPI_DEVICE_CLASS() to mod_devicetable.h base/node: Use 'property' to identify an access parameter driver core: device.h: add some missing kerneldocs kernfs: fix missing kernfs_idr_lock to remove an ID from the IDR isa: Remove unnecessary checks MAINTAINERS: add entry for auxiliary bus debugfs: Correct the 'debugfs_create_str' docs serial: qcom_geni: Comment use of devm_krealloc rather than devm_krealloc_array iio: adc: Use devm_krealloc_array hwmon: pmbus: Use devm_krealloc_array
2 parents 44aeec8 + a91845b commit fc75f21

16 files changed

Lines changed: 192 additions & 63 deletions

File tree

MAINTAINERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3385,6 +3385,16 @@ F: include/uapi/linux/audit.h
33853385
F: kernel/audit*
33863386
F: lib/*audit.c
33873387

3388+
AUXILIARY BUS DRIVER
3389+
M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3390+
R: Dave Ertman <david.m.ertman@intel.com>
3391+
R: Ira Weiny <ira.weiny@intel.com>
3392+
S: Supported
3393+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
3394+
F: Documentation/driver-api/auxiliary_bus.rst
3395+
F: drivers/base/auxiliary.c
3396+
F: include/linux/auxiliary_bus.h
3397+
33883398
AUXILIARY DISPLAY DRIVERS
33893399
M: Miguel Ojeda <ojeda@kernel.org>
33903400
S: Maintained

drivers/ata/ahci_platform.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
*/
1010

1111
#include <linux/kernel.h>
12+
#include <linux/mod_devicetable.h>
1213
#include <linux/module.h>
1314
#include <linux/pm.h>
1415
#include <linux/device.h>
15-
#include <linux/of_device.h>
1616
#include <linux/platform_device.h>
17+
#include <linux/property.h>
1718
#include <linux/libata.h>
1819
#include <linux/ahci_platform.h>
19-
#include <linux/acpi.h>
2020
#include <linux/pci_ids.h>
2121
#include "ahci.h"
2222

@@ -56,10 +56,10 @@ static int ahci_probe(struct platform_device *pdev)
5656
if (rc)
5757
return rc;
5858

59-
if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci"))
59+
if (device_is_compatible(dev, "hisilicon,hisi-ahci"))
6060
hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ;
6161

62-
port = acpi_device_get_match_data(dev);
62+
port = device_get_match_data(dev);
6363
if (!port)
6464
port = &ahci_port_info;
6565

drivers/base/isa.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,8 @@ int isa_register_driver(struct isa_driver *isa_driver, unsigned int ndev)
149149
break;
150150
}
151151

152-
if (isa_dev->dev.platform_data) {
153-
isa_dev->next = isa_driver->devices;
154-
isa_driver->devices = &isa_dev->dev;
155-
} else
156-
device_unregister(&isa_dev->dev);
152+
isa_dev->next = isa_driver->devices;
153+
isa_driver->devices = &isa_dev->dev;
157154
}
158155

159156
if (!error && !isa_driver->devices)

drivers/base/node.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,15 @@ static struct node_access_nodes *node_init_node_access(struct node *node,
162162
}
163163

164164
#ifdef CONFIG_HMEM_REPORTING
165-
#define ACCESS_ATTR(name) \
166-
static ssize_t name##_show(struct device *dev, \
165+
#define ACCESS_ATTR(property) \
166+
static ssize_t property##_show(struct device *dev, \
167167
struct device_attribute *attr, \
168168
char *buf) \
169169
{ \
170170
return sysfs_emit(buf, "%u\n", \
171-
to_access_nodes(dev)->hmem_attrs.name); \
171+
to_access_nodes(dev)->hmem_attrs.property); \
172172
} \
173-
static DEVICE_ATTR_RO(name)
173+
static DEVICE_ATTR_RO(property)
174174

175175
ACCESS_ATTR(read_bandwidth);
176176
ACCESS_ATTR(read_latency);

drivers/base/property.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -987,12 +987,18 @@ EXPORT_SYMBOL(fwnode_iomap);
987987
* @fwnode: Pointer to the firmware node
988988
* @index: Zero-based index of the IRQ
989989
*
990-
* Return: Linux IRQ number on success. Other values are determined
991-
* according to acpi_irq_get() or of_irq_get() operation.
990+
* Return: Linux IRQ number on success. Negative errno on failure.
992991
*/
993992
int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index)
994993
{
995-
return fwnode_call_int_op(fwnode, irq_get, index);
994+
int ret;
995+
996+
ret = fwnode_call_int_op(fwnode, irq_get, index);
997+
/* We treat mapping errors as invalid case */
998+
if (ret == 0)
999+
return -EINVAL;
1000+
1001+
return ret;
9961002
}
9971003
EXPORT_SYMBOL(fwnode_irq_get);
9981004

drivers/hwmon/pmbus/pmbus_core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,9 +1191,9 @@ static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr)
11911191
{
11921192
if (data->num_attributes >= data->max_attributes - 1) {
11931193
int new_max_attrs = data->max_attributes + PMBUS_ATTR_ALLOC_SIZE;
1194-
void *new_attrs = devm_krealloc(data->dev, data->group.attrs,
1195-
new_max_attrs * sizeof(void *),
1196-
GFP_KERNEL);
1194+
void *new_attrs = devm_krealloc_array(data->dev, data->group.attrs,
1195+
new_max_attrs, sizeof(void *),
1196+
GFP_KERNEL);
11971197
if (!new_attrs)
11981198
return -ENOMEM;
11991199
data->group.attrs = new_attrs;

drivers/iio/adc/xilinx-ams.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
12631263
struct device *dev = indio_dev->dev.parent;
12641264
struct fwnode_handle *child = NULL;
12651265
struct fwnode_handle *fwnode = dev_fwnode(dev);
1266-
size_t ams_size, dev_size;
1266+
size_t ams_size;
12671267
int ret, ch_cnt = 0, i, rising_off, falling_off;
12681268
unsigned int num_channels = 0;
12691269

@@ -1320,11 +1320,8 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
13201320
}
13211321
}
13221322

1323-
dev_size = array_size(sizeof(*dev_channels), num_channels);
1324-
if (dev_size == SIZE_MAX)
1325-
return -ENOMEM;
1326-
1327-
dev_channels = devm_krealloc(dev, ams_channels, dev_size, GFP_KERNEL);
1323+
dev_channels = devm_krealloc_array(dev, ams_channels, num_channels,
1324+
sizeof(*dev_channels), GFP_KERNEL);
13281325
if (!dev_channels)
13291326
return -ENOMEM;
13301327

drivers/iio/adc/xilinx-xadc-core.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -613,20 +613,17 @@ static int xadc_update_scan_mode(struct iio_dev *indio_dev,
613613
const unsigned long *mask)
614614
{
615615
struct xadc *xadc = iio_priv(indio_dev);
616-
size_t new_size, n;
616+
size_t n;
617617
void *data;
618618

619619
n = bitmap_weight(mask, indio_dev->masklength);
620620

621-
if (check_mul_overflow(n, sizeof(*xadc->data), &new_size))
622-
return -ENOMEM;
623-
624-
data = devm_krealloc(indio_dev->dev.parent, xadc->data,
625-
new_size, GFP_KERNEL);
621+
data = devm_krealloc_array(indio_dev->dev.parent, xadc->data,
622+
n, sizeof(*xadc->data), GFP_KERNEL);
626623
if (!data)
627624
return -ENOMEM;
628625

629-
memset(data, 0, new_size);
626+
memset(data, 0, n * sizeof(*xadc->data));
630627
xadc->data = data;
631628

632629
return 0;
@@ -1281,9 +1278,9 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, unsigned int *conf, int irq)
12811278
}
12821279

12831280
indio_dev->num_channels = num_channels;
1284-
indio_dev->channels = devm_krealloc(dev, channels,
1285-
sizeof(*channels) * num_channels,
1286-
GFP_KERNEL);
1281+
indio_dev->channels = devm_krealloc_array(dev, channels,
1282+
num_channels, sizeof(*channels),
1283+
GFP_KERNEL);
12871284
/* If we can't resize the channels array, just use the original */
12881285
if (!indio_dev->channels)
12891286
indio_dev->channels = channels;

drivers/tty/serial/qcom_geni_serial.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,11 @@ static int setup_fifos(struct qcom_geni_serial_port *port)
10531053
(port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE;
10541054

10551055
if (port->rx_buf && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
1056+
/*
1057+
* Use krealloc rather than krealloc_array because rx_buf is
1058+
* accessed as 1 byte entries as well as 4 byte entries so it's
1059+
* not necessarily an array.
1060+
*/
10561061
port->rx_buf = devm_krealloc(uport->dev, port->rx_buf,
10571062
port->rx_fifo_depth * sizeof(u32),
10581063
GFP_KERNEL);

fs/debugfs/file.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -940,15 +940,6 @@ static const struct file_operations fops_str_wo = {
940940
* This function creates a file in debugfs with the given name that
941941
* contains the value of the variable @value. If the @mode variable is so
942942
* set, it can be read from, and written to.
943-
*
944-
* This function will return a pointer to a dentry if it succeeds. This
945-
* pointer must be passed to the debugfs_remove() function when the file is
946-
* to be removed (no automatic cleanup happens if your module is unloaded,
947-
* you are responsible here.) If an error occurs, ERR_PTR(-ERROR) will be
948-
* returned.
949-
*
950-
* If debugfs is not enabled in the kernel, the value ERR_PTR(-ENODEV) will
951-
* be returned.
952943
*/
953944
void debugfs_create_str(const char *name, umode_t mode,
954945
struct dentry *parent, char **value)

0 commit comments

Comments
 (0)