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

Configure Feed

Select the types of activity you want to include in your feed.

fsi: Add aliased device numbering

The I2C and SPI subsystems can use an aliased name to number the device.
Add similar support to the FSI subsystem for any device type.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/20230612195657.245125-3-eajames@linux.ibm.com
Signed-off-by: Joel Stanley <joel@jms.id.au>

authored by

Eddie James and committed by
Joel Stanley
21930d80 d5d8dfb0

+25
+25
drivers/fsi/fsi-core.c
··· 934 934 return 0; 935 935 } 936 936 937 + static const char *const fsi_dev_type_names[] = { 938 + "cfam", 939 + "sbefifo", 940 + "scom", 941 + "occ", 942 + }; 943 + 937 944 int fsi_get_new_minor(struct fsi_device *fdev, enum fsi_dev_type type, 938 945 dev_t *out_dev, int *out_index) 939 946 { 947 + if (fdev->dev.of_node) { 948 + int aid = of_alias_get_id(fdev->dev.of_node, fsi_dev_type_names[type]); 949 + 950 + if (aid >= 0) { 951 + int id = (aid << 4) | type; 952 + 953 + id = ida_simple_get(&fsi_minor_ida, id, id + 1, GFP_KERNEL); 954 + if (id >= 0) { 955 + *out_index = aid; 956 + *out_dev = fsi_base_dev + id; 957 + return 0; 958 + } 959 + 960 + if (id != -ENOSPC) 961 + return id; 962 + } 963 + } 964 + 940 965 return __fsi_get_new_minor(fdev->slave, type, out_dev, out_index); 941 966 } 942 967 EXPORT_SYMBOL_GPL(fsi_get_new_minor);