@@ -43,7 +43,7 @@ EXPORT_TRACEPOINT_SYMBOL(spi_transfer_stop);
4343
4444#include "internals.h"
4545
46- static DEFINE_IDR (spi_master_idr );
46+ static DEFINE_IDR (spi_controller_idr );
4747
4848static void spidev_release (struct device * dev )
4949{
@@ -306,7 +306,7 @@ static const struct attribute_group spi_controller_statistics_group = {
306306 .attrs = spi_controller_statistics_attrs ,
307307};
308308
309- static const struct attribute_group * spi_master_groups [] = {
309+ static const struct attribute_group * spi_controller_groups [] = {
310310 & spi_controller_statistics_group ,
311311 NULL ,
312312};
@@ -1107,7 +1107,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
11071107 spi_toggle_csgpiod (spi , idx , enable , activate );
11081108 }
11091109 }
1110- /* Some SPI masters need both GPIO CS & slave_select */
1110+ /* Some SPI controllers need both GPIO CS & ->set_cs() */
11111111 if ((spi -> controller -> flags & SPI_CONTROLLER_GPIO_SS ) &&
11121112 spi -> controller -> set_cs )
11131113 spi -> controller -> set_cs (spi , !enable );
@@ -2532,7 +2532,7 @@ of_register_spi_device(struct spi_controller *ctlr, struct device_node *nc)
25322532 * @ctlr: Pointer to spi_controller device
25332533 *
25342534 * 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 .
25362536 */
25372537static void of_register_spi_devices (struct spi_controller * ctlr )
25382538{
@@ -2817,7 +2817,7 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
28172817 if (!lookup .max_speed_hz &&
28182818 ACPI_SUCCESS (acpi_get_parent (adev -> handle , & parent_handle )) &&
28192819 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 */
28212821 acpi_spi_parse_apple_properties (adev , & lookup );
28222822 }
28232823
@@ -2909,7 +2909,7 @@ static void acpi_register_spi_devices(struct spi_controller *ctlr)
29092909 SPI_ACPI_ENUMERATE_MAX_DEPTH ,
29102910 acpi_spi_add_device , NULL , ctlr , NULL );
29112911 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" );
29132913}
29142914#else
29152915static inline void acpi_register_spi_devices (struct spi_controller * ctlr ) {}
@@ -2923,16 +2923,15 @@ static void spi_controller_release(struct device *dev)
29232923 kfree (ctlr );
29242924}
29252925
2926- static const struct class spi_master_class = {
2926+ static const struct class spi_controller_class = {
29272927 .name = "spi_master" ,
29282928 .dev_release = spi_controller_release ,
2929- .dev_groups = spi_master_groups ,
2929+ .dev_groups = spi_controller_groups ,
29302930};
29312931
29322932#ifdef CONFIG_SPI_SLAVE
29332933/**
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
29362935 * @spi: device used for the current transfer
29372936 */
29382937int spi_target_abort (struct spi_device * spi )
@@ -2973,13 +2972,13 @@ static ssize_t slave_store(struct device *dev, struct device_attribute *attr,
29732972
29742973 child = device_find_any_child (& ctlr -> dev );
29752974 if (child ) {
2976- /* Remove registered slave */
2975+ /* Remove registered target device */
29772976 device_unregister (child );
29782977 put_device (child );
29792978 }
29802979
29812980 if (strcmp (name , "(null)" )) {
2982- /* Register new slave */
2981+ /* Register new target device */
29832982 spi = spi_alloc_device (ctlr );
29842983 if (!spi )
29852984 return - ENOMEM ;
@@ -2998,40 +2997,40 @@ static ssize_t slave_store(struct device *dev, struct device_attribute *attr,
29982997
29992998static DEVICE_ATTR_RW (slave );
30002999
3001- static struct attribute * spi_slave_attrs [] = {
3000+ static struct attribute * spi_target_attrs [] = {
30023001 & dev_attr_slave .attr ,
30033002 NULL ,
30043003};
30053004
3006- static const struct attribute_group spi_slave_group = {
3007- .attrs = spi_slave_attrs ,
3005+ static const struct attribute_group spi_target_group = {
3006+ .attrs = spi_target_attrs ,
30083007};
30093008
3010- static const struct attribute_group * spi_slave_groups [] = {
3009+ static const struct attribute_group * spi_target_groups [] = {
30113010 & spi_controller_statistics_group ,
3012- & spi_slave_group ,
3011+ & spi_target_group ,
30133012 NULL ,
30143013};
30153014
3016- static const struct class spi_slave_class = {
3015+ static const struct class spi_target_class = {
30173016 .name = "spi_slave" ,
30183017 .dev_release = spi_controller_release ,
3019- .dev_groups = spi_slave_groups ,
3018+ .dev_groups = spi_target_groups ,
30203019};
30213020#else
3022- extern struct class spi_slave_class ; /* dummy */
3021+ extern struct class spi_target_class ; /* dummy */
30233022#endif
30243023
30253024/**
3026- * __spi_alloc_controller - allocate an SPI master or slave controller
3025+ * __spi_alloc_controller - allocate an SPI host or target controller
30273026 * @dev: the controller, possibly using the platform_bus
30283027 * @size: how much zeroed driver-private data to allocate; the pointer to this
30293028 * memory is in the driver_data field of the returned device, accessible
30303029 * with spi_controller_get_devdata(); the memory is cacheline aligned;
30313030 * drivers granting DMA access to portions of their private data need to
30323031 * round up @size using ALIGN(size, dma_get_cache_alignment()).
3033- * @slave : flag indicating whether to allocate an SPI master (false) or SPI
3034- * slave (true) controller
3032+ * @target : flag indicating whether to allocate an SPI host (false) or SPI target (true)
3033+ * controller
30353034 * Context: can sleep
30363035 *
30373036 * This call is used only by SPI controller drivers, which are the
@@ -3048,7 +3047,7 @@ extern struct class spi_slave_class; /* dummy */
30483047 * Return: the SPI controller structure on success, else NULL.
30493048 */
30503049struct spi_controller * __spi_alloc_controller (struct device * dev ,
3051- unsigned int size , bool slave )
3050+ unsigned int size , bool target )
30523051{
30533052 struct spi_controller * ctlr ;
30543053 size_t ctlr_size = ALIGN (sizeof (* ctlr ), dma_get_cache_alignment ());
@@ -3069,11 +3068,11 @@ struct spi_controller *__spi_alloc_controller(struct device *dev,
30693068 mutex_init (& ctlr -> add_lock );
30703069 ctlr -> bus_num = -1 ;
30713070 ctlr -> num_chipselect = 1 ;
3072- ctlr -> slave = slave ;
3073- if (IS_ENABLED (CONFIG_SPI_SLAVE ) && slave )
3074- ctlr -> dev .class = & spi_slave_class ;
3071+ ctlr -> target = target ;
3072+ if (IS_ENABLED (CONFIG_SPI_SLAVE ) && target )
3073+ ctlr -> dev .class = & spi_target_class ;
30753074 else
3076- ctlr -> dev .class = & spi_master_class ;
3075+ ctlr -> dev .class = & spi_controller_class ;
30773076 ctlr -> dev .parent = dev ;
30783077 pm_suspend_ignore_children (& ctlr -> dev , true);
30793078 spi_controller_set_devdata (ctlr , (void * )ctlr + ctlr_size );
@@ -3091,7 +3090,7 @@ static void devm_spi_release_controller(struct device *dev, void *ctlr)
30913090 * __devm_spi_alloc_controller - resource-managed __spi_alloc_controller()
30923091 * @dev: physical device of SPI controller
30933092 * @size: how much zeroed driver-private data to allocate
3094- * @slave : whether to allocate an SPI master (false) or SPI slave (true)
3093+ * @target : whether to allocate an SPI host (false) or SPI target (true) controller
30953094 * Context: can sleep
30963095 *
30973096 * Allocate an SPI controller and automatically release a reference on it
@@ -3104,7 +3103,7 @@ static void devm_spi_release_controller(struct device *dev, void *ctlr)
31043103 */
31053104struct spi_controller * __devm_spi_alloc_controller (struct device * dev ,
31063105 unsigned int size ,
3107- bool slave )
3106+ bool target )
31083107{
31093108 struct spi_controller * * ptr , * ctlr ;
31103109
@@ -3113,7 +3112,7 @@ struct spi_controller *__devm_spi_alloc_controller(struct device *dev,
31133112 if (!ptr )
31143113 return NULL ;
31153114
3116- ctlr = __spi_alloc_controller (dev , size , slave );
3115+ ctlr = __spi_alloc_controller (dev , size , target );
31173116 if (ctlr ) {
31183117 ctlr -> devm_allocated = true;
31193118 * ptr = ctlr ;
@@ -3127,8 +3126,8 @@ struct spi_controller *__devm_spi_alloc_controller(struct device *dev,
31273126EXPORT_SYMBOL_GPL (__devm_spi_alloc_controller );
31283127
31293128/**
3130- * spi_get_gpio_descs() - grab chip select GPIOs for the master
3131- * @ctlr: The SPI master to grab GPIO descriptors for
3129+ * spi_get_gpio_descs() - grab chip select GPIOs for the controller
3130+ * @ctlr: The SPI controller to grab GPIO descriptors for
31323131 */
31333132static int spi_get_gpio_descs (struct spi_controller * ctlr )
31343133{
@@ -3226,7 +3225,7 @@ static int spi_controller_id_alloc(struct spi_controller *ctlr, int start, int e
32263225 int id ;
32273226
32283227 mutex_lock (& board_lock );
3229- id = idr_alloc (& spi_master_idr , ctlr , start , end , GFP_KERNEL );
3228+ id = idr_alloc (& spi_controller_idr , ctlr , start , end , GFP_KERNEL );
32303229 mutex_unlock (& board_lock );
32313230 if (WARN (id < 0 , "couldn't get idr" ))
32323231 return id == - ENOSPC ? - EBUSY : id ;
@@ -3375,7 +3374,7 @@ int spi_register_controller(struct spi_controller *ctlr)
33753374 spi_destroy_queue (ctlr );
33763375free_bus_id :
33773376 mutex_lock (& board_lock );
3378- idr_remove (& spi_master_idr , ctlr -> bus_num );
3377+ idr_remove (& spi_controller_idr , ctlr -> bus_num );
33793378 mutex_unlock (& board_lock );
33803379 return status ;
33813380}
@@ -3387,8 +3386,7 @@ static void devm_spi_unregister(struct device *dev, void *res)
33873386}
33883387
33893388/**
3390- * devm_spi_register_controller - register managed SPI host or target
3391- * controller
3389+ * devm_spi_register_controller - register managed SPI host or target controller
33923390 * @dev: device managing SPI controller
33933391 * @ctlr: initialized controller, originally from spi_alloc_host() or
33943392 * spi_alloc_target()
@@ -3428,7 +3426,7 @@ static int __unregister(struct device *dev, void *null)
34283426}
34293427
34303428/**
3431- * spi_unregister_controller - unregister SPI master or slave controller
3429+ * spi_unregister_controller - unregister SPI host or target controller
34323430 * @ctlr: the controller being unregistered
34333431 * Context: can sleep
34343432 *
@@ -3452,7 +3450,7 @@ void spi_unregister_controller(struct spi_controller *ctlr)
34523450
34533451 /* First make sure that this controller was ever added */
34543452 mutex_lock (& board_lock );
3455- found = idr_find (& spi_master_idr , id );
3453+ found = idr_find (& spi_controller_idr , id );
34563454 mutex_unlock (& board_lock );
34573455 if (ctlr -> queued ) {
34583456 if (spi_destroy_queue (ctlr ))
@@ -3467,7 +3465,7 @@ void spi_unregister_controller(struct spi_controller *ctlr)
34673465 /* Free bus id */
34683466 mutex_lock (& board_lock );
34693467 if (found == ctlr )
3470- idr_remove (& spi_master_idr , id );
3468+ idr_remove (& spi_controller_idr , id );
34713469 mutex_unlock (& board_lock );
34723470
34733471 if (IS_ENABLED (CONFIG_SPI_DYNAMIC ))
@@ -4620,7 +4618,7 @@ EXPORT_SYMBOL_GPL(spi_sync_locked);
46204618
46214619/**
46224620 * spi_bus_lock - obtain a lock for exclusive SPI bus usage
4623- * @ctlr: SPI bus master that should be locked for exclusive bus access
4621+ * @ctlr: SPI bus controller that should be locked for exclusive bus access
46244622 * Context: can sleep
46254623 *
46264624 * This call may only be used from a context that may sleep. The sleep
@@ -4651,7 +4649,7 @@ EXPORT_SYMBOL_GPL(spi_bus_lock);
46514649
46524650/**
46534651 * spi_bus_unlock - release the lock for exclusive SPI bus usage
4654- * @ctlr: SPI bus master that was locked for exclusive bus access
4652+ * @ctlr: SPI bus controller that was locked for exclusive bus access
46554653 * Context: can sleep
46564654 *
46574655 * This call may only be used from a context that may sleep. The sleep
@@ -4768,9 +4766,9 @@ static struct spi_controller *of_find_spi_controller_by_node(struct device_node
47684766{
47694767 struct device * dev ;
47704768
4771- dev = class_find_device_by_of_node (& spi_master_class , node );
4769+ dev = class_find_device_by_of_node (& spi_controller_class , node );
47724770 if (!dev && IS_ENABLED (CONFIG_SPI_SLAVE ))
4773- dev = class_find_device_by_of_node (& spi_slave_class , node );
4771+ dev = class_find_device_by_of_node (& spi_target_class , node );
47744772 if (!dev )
47754773 return NULL ;
47764774
@@ -4850,10 +4848,10 @@ struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev
48504848{
48514849 struct device * dev ;
48524850
4853- dev = class_find_device (& spi_master_class , NULL , adev ,
4851+ dev = class_find_device (& spi_controller_class , NULL , adev ,
48544852 spi_acpi_controller_match );
48554853 if (!dev && IS_ENABLED (CONFIG_SPI_SLAVE ))
4856- dev = class_find_device (& spi_slave_class , NULL , adev ,
4854+ dev = class_find_device (& spi_target_class , NULL , adev ,
48574855 spi_acpi_controller_match );
48584856 if (!dev )
48594857 return NULL ;
@@ -4923,12 +4921,12 @@ static int __init spi_init(void)
49234921 if (status < 0 )
49244922 goto err1 ;
49254923
4926- status = class_register (& spi_master_class );
4924+ status = class_register (& spi_controller_class );
49274925 if (status < 0 )
49284926 goto err2 ;
49294927
49304928 if (IS_ENABLED (CONFIG_SPI_SLAVE )) {
4931- status = class_register (& spi_slave_class );
4929+ status = class_register (& spi_target_class );
49324930 if (status < 0 )
49334931 goto err3 ;
49344932 }
@@ -4941,7 +4939,7 @@ static int __init spi_init(void)
49414939 return 0 ;
49424940
49434941err3 :
4944- class_unregister (& spi_master_class );
4942+ class_unregister (& spi_controller_class );
49454943err2 :
49464944 bus_unregister (& spi_bus_type );
49474945err1 :
0 commit comments