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

spi: Use inclusive language

Replace "master" by "[host] controller" in the SPI core code and comments.
All the similar to the "slave" by "target [device]" changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250313140340.380359-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Andy Shevchenko and committed by
Mark Brown
91ce208d cce2200d

+64 -66
+47 -49
drivers/spi/spi.c
··· 43 43 44 44 #include "internals.h" 45 45 46 - static DEFINE_IDR(spi_master_idr); 46 + static DEFINE_IDR(spi_controller_idr); 47 47 48 48 static void spidev_release(struct device *dev) 49 49 { ··· 306 306 .attrs = spi_controller_statistics_attrs, 307 307 }; 308 308 309 - static const struct attribute_group *spi_master_groups[] = { 309 + static const struct attribute_group *spi_controller_groups[] = { 310 310 &spi_controller_statistics_group, 311 311 NULL, 312 312 }; ··· 1107 1107 spi_toggle_csgpiod(spi, idx, enable, activate); 1108 1108 } 1109 1109 } 1110 - /* Some SPI masters need both GPIO CS & slave_select */ 1110 + /* Some SPI controllers need both GPIO CS & ->set_cs() */ 1111 1111 if ((spi->controller->flags & SPI_CONTROLLER_GPIO_SS) && 1112 1112 spi->controller->set_cs) 1113 1113 spi->controller->set_cs(spi, !enable); ··· 2532 2532 * @ctlr: Pointer to spi_controller device 2533 2533 * 2534 2534 * Registers an spi_device for each child node of controller node which 2535 - * represents a valid SPI slave. 2535 + * represents a valid SPI target device. 2536 2536 */ 2537 2537 static void of_register_spi_devices(struct spi_controller *ctlr) 2538 2538 { ··· 2817 2817 if (!lookup.max_speed_hz && 2818 2818 ACPI_SUCCESS(acpi_get_parent(adev->handle, &parent_handle)) && 2819 2819 device_match_acpi_handle(lookup.ctlr->dev.parent, parent_handle)) { 2820 - /* Apple does not use _CRS but nested devices for SPI slaves */ 2820 + /* Apple does not use _CRS but nested devices for SPI target devices */ 2821 2821 acpi_spi_parse_apple_properties(adev, &lookup); 2822 2822 } 2823 2823 ··· 2909 2909 SPI_ACPI_ENUMERATE_MAX_DEPTH, 2910 2910 acpi_spi_add_device, NULL, ctlr, NULL); 2911 2911 if (ACPI_FAILURE(status)) 2912 - dev_warn(&ctlr->dev, "failed to enumerate SPI slaves\n"); 2912 + dev_warn(&ctlr->dev, "failed to enumerate SPI target devices\n"); 2913 2913 } 2914 2914 #else 2915 2915 static inline void acpi_register_spi_devices(struct spi_controller *ctlr) {} ··· 2923 2923 kfree(ctlr); 2924 2924 } 2925 2925 2926 - static const struct class spi_master_class = { 2926 + static const struct class spi_controller_class = { 2927 2927 .name = "spi_master", 2928 2928 .dev_release = spi_controller_release, 2929 - .dev_groups = spi_master_groups, 2929 + .dev_groups = spi_controller_groups, 2930 2930 }; 2931 2931 2932 2932 #ifdef CONFIG_SPI_SLAVE 2933 2933 /** 2934 - * spi_target_abort - abort the ongoing transfer request on an SPI slave 2935 - * controller 2934 + * spi_target_abort - abort the ongoing transfer request on an SPI target controller 2936 2935 * @spi: device used for the current transfer 2937 2936 */ 2938 2937 int spi_target_abort(struct spi_device *spi) ··· 2972 2973 2973 2974 child = device_find_any_child(&ctlr->dev); 2974 2975 if (child) { 2975 - /* Remove registered slave */ 2976 + /* Remove registered target device */ 2976 2977 device_unregister(child); 2977 2978 put_device(child); 2978 2979 } 2979 2980 2980 2981 if (strcmp(name, "(null)")) { 2981 - /* Register new slave */ 2982 + /* Register new target device */ 2982 2983 spi = spi_alloc_device(ctlr); 2983 2984 if (!spi) 2984 2985 return -ENOMEM; ··· 2997 2998 2998 2999 static DEVICE_ATTR_RW(slave); 2999 3000 3000 - static struct attribute *spi_slave_attrs[] = { 3001 + static struct attribute *spi_target_attrs[] = { 3001 3002 &dev_attr_slave.attr, 3002 3003 NULL, 3003 3004 }; 3004 3005 3005 - static const struct attribute_group spi_slave_group = { 3006 - .attrs = spi_slave_attrs, 3006 + static const struct attribute_group spi_target_group = { 3007 + .attrs = spi_target_attrs, 3007 3008 }; 3008 3009 3009 - static const struct attribute_group *spi_slave_groups[] = { 3010 + static const struct attribute_group *spi_target_groups[] = { 3010 3011 &spi_controller_statistics_group, 3011 - &spi_slave_group, 3012 + &spi_target_group, 3012 3013 NULL, 3013 3014 }; 3014 3015 3015 - static const struct class spi_slave_class = { 3016 + static const struct class spi_target_class = { 3016 3017 .name = "spi_slave", 3017 3018 .dev_release = spi_controller_release, 3018 - .dev_groups = spi_slave_groups, 3019 + .dev_groups = spi_target_groups, 3019 3020 }; 3020 3021 #else 3021 - extern struct class spi_slave_class; /* dummy */ 3022 + extern struct class spi_target_class; /* dummy */ 3022 3023 #endif 3023 3024 3024 3025 /** 3025 - * __spi_alloc_controller - allocate an SPI master or slave controller 3026 + * __spi_alloc_controller - allocate an SPI host or target controller 3026 3027 * @dev: the controller, possibly using the platform_bus 3027 3028 * @size: how much zeroed driver-private data to allocate; the pointer to this 3028 3029 * memory is in the driver_data field of the returned device, accessible 3029 3030 * with spi_controller_get_devdata(); the memory is cacheline aligned; 3030 3031 * drivers granting DMA access to portions of their private data need to 3031 3032 * round up @size using ALIGN(size, dma_get_cache_alignment()). 3032 - * @slave: flag indicating whether to allocate an SPI master (false) or SPI 3033 - * slave (true) controller 3033 + * @target: flag indicating whether to allocate an SPI host (false) or SPI target (true) 3034 + * controller 3034 3035 * Context: can sleep 3035 3036 * 3036 3037 * This call is used only by SPI controller drivers, which are the ··· 3047 3048 * Return: the SPI controller structure on success, else NULL. 3048 3049 */ 3049 3050 struct spi_controller *__spi_alloc_controller(struct device *dev, 3050 - unsigned int size, bool slave) 3051 + unsigned int size, bool target) 3051 3052 { 3052 3053 struct spi_controller *ctlr; 3053 3054 size_t ctlr_size = ALIGN(sizeof(*ctlr), dma_get_cache_alignment()); ··· 3068 3069 mutex_init(&ctlr->add_lock); 3069 3070 ctlr->bus_num = -1; 3070 3071 ctlr->num_chipselect = 1; 3071 - ctlr->slave = slave; 3072 - if (IS_ENABLED(CONFIG_SPI_SLAVE) && slave) 3073 - ctlr->dev.class = &spi_slave_class; 3072 + ctlr->target = target; 3073 + if (IS_ENABLED(CONFIG_SPI_SLAVE) && target) 3074 + ctlr->dev.class = &spi_target_class; 3074 3075 else 3075 - ctlr->dev.class = &spi_master_class; 3076 + ctlr->dev.class = &spi_controller_class; 3076 3077 ctlr->dev.parent = dev; 3077 3078 pm_suspend_ignore_children(&ctlr->dev, true); 3078 3079 spi_controller_set_devdata(ctlr, (void *)ctlr + ctlr_size); ··· 3090 3091 * __devm_spi_alloc_controller - resource-managed __spi_alloc_controller() 3091 3092 * @dev: physical device of SPI controller 3092 3093 * @size: how much zeroed driver-private data to allocate 3093 - * @slave: whether to allocate an SPI master (false) or SPI slave (true) 3094 + * @target: whether to allocate an SPI host (false) or SPI target (true) controller 3094 3095 * Context: can sleep 3095 3096 * 3096 3097 * Allocate an SPI controller and automatically release a reference on it ··· 3103 3104 */ 3104 3105 struct spi_controller *__devm_spi_alloc_controller(struct device *dev, 3105 3106 unsigned int size, 3106 - bool slave) 3107 + bool target) 3107 3108 { 3108 3109 struct spi_controller **ptr, *ctlr; 3109 3110 ··· 3112 3113 if (!ptr) 3113 3114 return NULL; 3114 3115 3115 - ctlr = __spi_alloc_controller(dev, size, slave); 3116 + ctlr = __spi_alloc_controller(dev, size, target); 3116 3117 if (ctlr) { 3117 3118 ctlr->devm_allocated = true; 3118 3119 *ptr = ctlr; ··· 3126 3127 EXPORT_SYMBOL_GPL(__devm_spi_alloc_controller); 3127 3128 3128 3129 /** 3129 - * spi_get_gpio_descs() - grab chip select GPIOs for the master 3130 - * @ctlr: The SPI master to grab GPIO descriptors for 3130 + * spi_get_gpio_descs() - grab chip select GPIOs for the controller 3131 + * @ctlr: The SPI controller to grab GPIO descriptors for 3131 3132 */ 3132 3133 static int spi_get_gpio_descs(struct spi_controller *ctlr) 3133 3134 { ··· 3225 3226 int id; 3226 3227 3227 3228 mutex_lock(&board_lock); 3228 - id = idr_alloc(&spi_master_idr, ctlr, start, end, GFP_KERNEL); 3229 + id = idr_alloc(&spi_controller_idr, ctlr, start, end, GFP_KERNEL); 3229 3230 mutex_unlock(&board_lock); 3230 3231 if (WARN(id < 0, "couldn't get idr")) 3231 3232 return id == -ENOSPC ? -EBUSY : id; ··· 3374 3375 spi_destroy_queue(ctlr); 3375 3376 free_bus_id: 3376 3377 mutex_lock(&board_lock); 3377 - idr_remove(&spi_master_idr, ctlr->bus_num); 3378 + idr_remove(&spi_controller_idr, ctlr->bus_num); 3378 3379 mutex_unlock(&board_lock); 3379 3380 return status; 3380 3381 } ··· 3386 3387 } 3387 3388 3388 3389 /** 3389 - * devm_spi_register_controller - register managed SPI host or target 3390 - * controller 3390 + * devm_spi_register_controller - register managed SPI host or target controller 3391 3391 * @dev: device managing SPI controller 3392 3392 * @ctlr: initialized controller, originally from spi_alloc_host() or 3393 3393 * spi_alloc_target() ··· 3426 3428 } 3427 3429 3428 3430 /** 3429 - * spi_unregister_controller - unregister SPI master or slave controller 3431 + * spi_unregister_controller - unregister SPI host or target controller 3430 3432 * @ctlr: the controller being unregistered 3431 3433 * Context: can sleep 3432 3434 * ··· 3450 3452 3451 3453 /* First make sure that this controller was ever added */ 3452 3454 mutex_lock(&board_lock); 3453 - found = idr_find(&spi_master_idr, id); 3455 + found = idr_find(&spi_controller_idr, id); 3454 3456 mutex_unlock(&board_lock); 3455 3457 if (ctlr->queued) { 3456 3458 if (spi_destroy_queue(ctlr)) ··· 3465 3467 /* Free bus id */ 3466 3468 mutex_lock(&board_lock); 3467 3469 if (found == ctlr) 3468 - idr_remove(&spi_master_idr, id); 3470 + idr_remove(&spi_controller_idr, id); 3469 3471 mutex_unlock(&board_lock); 3470 3472 3471 3473 if (IS_ENABLED(CONFIG_SPI_DYNAMIC)) ··· 4618 4620 4619 4621 /** 4620 4622 * spi_bus_lock - obtain a lock for exclusive SPI bus usage 4621 - * @ctlr: SPI bus master that should be locked for exclusive bus access 4623 + * @ctlr: SPI bus controller that should be locked for exclusive bus access 4622 4624 * Context: can sleep 4623 4625 * 4624 4626 * This call may only be used from a context that may sleep. The sleep ··· 4649 4651 4650 4652 /** 4651 4653 * spi_bus_unlock - release the lock for exclusive SPI bus usage 4652 - * @ctlr: SPI bus master that was locked for exclusive bus access 4654 + * @ctlr: SPI bus controller that was locked for exclusive bus access 4653 4655 * Context: can sleep 4654 4656 * 4655 4657 * This call may only be used from a context that may sleep. The sleep ··· 4766 4768 { 4767 4769 struct device *dev; 4768 4770 4769 - dev = class_find_device_by_of_node(&spi_master_class, node); 4771 + dev = class_find_device_by_of_node(&spi_controller_class, node); 4770 4772 if (!dev && IS_ENABLED(CONFIG_SPI_SLAVE)) 4771 - dev = class_find_device_by_of_node(&spi_slave_class, node); 4773 + dev = class_find_device_by_of_node(&spi_target_class, node); 4772 4774 if (!dev) 4773 4775 return NULL; 4774 4776 ··· 4848 4850 { 4849 4851 struct device *dev; 4850 4852 4851 - dev = class_find_device(&spi_master_class, NULL, adev, 4853 + dev = class_find_device(&spi_controller_class, NULL, adev, 4852 4854 spi_acpi_controller_match); 4853 4855 if (!dev && IS_ENABLED(CONFIG_SPI_SLAVE)) 4854 - dev = class_find_device(&spi_slave_class, NULL, adev, 4856 + dev = class_find_device(&spi_target_class, NULL, adev, 4855 4857 spi_acpi_controller_match); 4856 4858 if (!dev) 4857 4859 return NULL; ··· 4921 4923 if (status < 0) 4922 4924 goto err1; 4923 4925 4924 - status = class_register(&spi_master_class); 4926 + status = class_register(&spi_controller_class); 4925 4927 if (status < 0) 4926 4928 goto err2; 4927 4929 4928 4930 if (IS_ENABLED(CONFIG_SPI_SLAVE)) { 4929 - status = class_register(&spi_slave_class); 4931 + status = class_register(&spi_target_class); 4930 4932 if (status < 0) 4931 4933 goto err3; 4932 4934 } ··· 4939 4941 return 0; 4940 4942 4941 4943 err3: 4942 - class_unregister(&spi_master_class); 4944 + class_unregister(&spi_controller_class); 4943 4945 err2: 4944 4946 bus_unregister(&spi_bus_type); 4945 4947 err1:
+17 -17
include/linux/spi/spi.h
··· 35 35 struct spi_offload_config; 36 36 37 37 /* 38 - * INTERFACES between SPI master-side drivers and SPI slave protocol handlers, 38 + * INTERFACES between SPI controller-side drivers and SPI target protocol handlers, 39 39 * and SPI infrastructure. 40 40 */ 41 41 extern const struct bus_type spi_bus_type; ··· 130 130 struct spi_transfer *xfer); 131 131 132 132 /** 133 - * struct spi_device - Controller side proxy for an SPI slave device 133 + * struct spi_device - Controller side proxy for an SPI target device 134 134 * @dev: Driver model representation of the device. 135 135 * @controller: SPI controller used with the device. 136 136 * @max_speed_hz: Maximum clock rate to be used with this chip ··· 174 174 * @pcpu_statistics: statistics for the spi_device 175 175 * @cs_index_mask: Bit mask of the active chipselect(s) in the chipselect array 176 176 * 177 - * A @spi_device is used to interchange data between an SPI slave 177 + * A @spi_device is used to interchange data between an SPI target device 178 178 * (usually a discrete chip) and CPU memory. 179 179 * 180 180 * In @dev, the platform_data is used to hold information about this ··· 388 388 spi_unregister_driver) 389 389 390 390 /** 391 - * struct spi_controller - interface to SPI master or slave controller 391 + * struct spi_controller - interface to SPI host or target controller 392 392 * @dev: device interface to this driver 393 393 * @list: link with the global spi_controller list 394 394 * @bus_num: board-specific (and often SOC-specific) identifier for a 395 395 * given SPI controller. 396 396 * @num_chipselect: chipselects are used to distinguish individual 397 - * SPI slaves, and are numbered from zero to num_chipselects. 398 - * each slave has a chipselect signal, but it's common that not 399 - * every chipselect is connected to a slave. 397 + * SPI targets, and are numbered from zero to num_chipselects. 398 + * each target has a chipselect signal, but it's common that not 399 + * every chipselect is connected to a target. 400 400 * @dma_alignment: SPI controller constraint on DMA buffers alignment. 401 401 * @mode_bits: flags understood by this controller driver 402 402 * @buswidth_override_bits: flags to override for this controller driver ··· 425 425 * must fail if an unrecognized or unsupported mode is requested. 426 426 * It's always safe to call this unless transfers are pending on 427 427 * the device whose settings are being modified. 428 - * @set_cs_timing: optional hook for SPI devices to request SPI master 428 + * @set_cs_timing: optional hook for SPI devices to request SPI 429 429 * controller for configuring specific CS setup time, hold time and inactive 430 - * delay interms of clock counts 430 + * delay in terms of clock counts 431 431 * @transfer: adds a message to the controller's transfer queue. 432 432 * @cleanup: frees controller-specific state 433 433 * @can_dma: determine whether this controller supports DMA ··· 547 547 * 548 548 * The driver for an SPI controller manages access to those devices through 549 549 * a queue of spi_message transactions, copying data between CPU memory and 550 - * an SPI slave device. For each such message it queues, it calls the 550 + * an SPI target device. For each such message it queues, it calls the 551 551 * message's completion function when the transaction completes. 552 552 */ 553 553 struct spi_controller { ··· 597 597 #define SPI_CONTROLLER_NO_TX BIT(2) /* Can't do buffer write */ 598 598 #define SPI_CONTROLLER_MUST_RX BIT(3) /* Requires rx */ 599 599 #define SPI_CONTROLLER_MUST_TX BIT(4) /* Requires tx */ 600 - #define SPI_CONTROLLER_GPIO_SS BIT(5) /* GPIO CS must select slave */ 600 + #define SPI_CONTROLLER_GPIO_SS BIT(5) /* GPIO CS must select target device */ 601 601 #define SPI_CONTROLLER_SUSPENDED BIT(6) /* Currently suspended */ 602 602 /* 603 603 * The spi-controller has multi chip select capability and can ··· 664 664 * + To a given spi_device, message queueing is pure FIFO 665 665 * 666 666 * + The controller's main job is to process its message queue, 667 - * selecting a chip (for masters), then transferring data 667 + * selecting a chip (for controllers), then transferring data 668 668 * + If there are multiple spi_device children, the i/o queue 669 669 * arbitration algorithm is unspecified (round robin, FIFO, 670 670 * priority, reservations, preemption, etc) ··· 832 832 833 833 /* The SPI driver core manages memory for the spi_controller classdev */ 834 834 extern struct spi_controller *__spi_alloc_controller(struct device *host, 835 - unsigned int size, bool slave); 835 + unsigned int size, bool target); 836 836 837 837 static inline struct spi_controller *spi_alloc_host(struct device *dev, 838 838 unsigned int size) ··· 851 851 852 852 struct spi_controller *__devm_spi_alloc_controller(struct device *dev, 853 853 unsigned int size, 854 - bool slave); 854 + bool target); 855 855 856 856 static inline struct spi_controller *devm_spi_alloc_host(struct device *dev, 857 857 unsigned int size) ··· 989 989 * purposefully (instead of setting to spi_transfer->len - 1) to denote 990 990 * that a transfer-level snapshot taken from within the driver may still 991 991 * be of higher quality. 992 - * @ptp_sts: Pointer to a memory location held by the SPI slave device where a 992 + * @ptp_sts: Pointer to a memory location held by the SPI target device where a 993 993 * PTP system timestamp structure may lie. If drivers use PIO or their 994 994 * hardware has some sort of assist for retrieving exact transfer timing, 995 995 * they can (and should) assert @ptp_sts_supported and populate this 996 996 * structure using the ptp_read_system_*ts helper functions. 997 - * The timestamp must represent the time at which the SPI slave device has 997 + * The timestamp must represent the time at which the SPI target device has 998 998 * processed the word, i.e. the "pre" timestamp should be taken before 999 999 * transmitting the "pre" word, and the "post" timestamp after receiving 1000 1000 * transmit confirmation from the controller for the "post" word. ··· 1622 1622 * bus_num is board specific and matches the bus_num of some 1623 1623 * spi_controller that will probably be registered later. 1624 1624 * 1625 - * chip_select reflects how this chip is wired to that master; 1625 + * chip_select reflects how this chip is wired to that controller; 1626 1626 * it's less than num_chipselect. 1627 1627 */ 1628 1628 u16 bus_num;