@@ -43,7 +43,7 @@ EXPORT_TRACEPOINT_SYMBOL(spi_transfer_stop);
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,7 +306,7 @@ static const struct attribute_group spi_controller_statistics_group = {
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,7 +1107,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
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,7 +2532,7 @@ of_register_spi_device(struct spi_controller *ctlr, struct device_node *nc)
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,7 +2817,7 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
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,7 +2909,7 @@ static void acpi_register_spi_devices(struct spi_controller *ctlr)
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,16 +2923,15 @@ static void spi_controller_release(struct device *dev)
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 )
@@ -2973,13 +2972,13 @@ static ssize_t slave_store(struct device *dev, struct device_attribute *attr,
2973
2972
2974
2973
child = device_find_any_child (& ctlr -> dev );
2975
2974
if (child ) {
2976
- /* Remove registered slave */
2975
+ /* Remove registered target device */
2977
2976
device_unregister (child );
2978
2977
put_device (child );
2979
2978
}
2980
2979
2981
2980
if (strcmp (name , "(null)" )) {
2982
- /* Register new slave */
2981
+ /* Register new target device */
2983
2982
spi = spi_alloc_device (ctlr );
2984
2983
if (!spi )
2985
2984
return - ENOMEM ;
@@ -2998,40 +2997,40 @@ static ssize_t slave_store(struct device *dev, struct device_attribute *attr,
2998
2997
2999
2998
static DEVICE_ATTR_RW (slave );
3000
2999
3001
- static struct attribute * spi_slave_attrs [] = {
3000
+ static struct attribute * spi_target_attrs [] = {
3002
3001
& dev_attr_slave .attr ,
3003
3002
NULL ,
3004
3003
};
3005
3004
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 ,
3008
3007
};
3009
3008
3010
- static const struct attribute_group * spi_slave_groups [] = {
3009
+ static const struct attribute_group * spi_target_groups [] = {
3011
3010
& spi_controller_statistics_group ,
3012
- & spi_slave_group ,
3011
+ & spi_target_group ,
3013
3012
NULL ,
3014
3013
};
3015
3014
3016
- static const struct class spi_slave_class = {
3015
+ static const struct class spi_target_class = {
3017
3016
.name = "spi_slave" ,
3018
3017
.dev_release = spi_controller_release ,
3019
- .dev_groups = spi_slave_groups ,
3018
+ .dev_groups = spi_target_groups ,
3020
3019
};
3021
3020
#else
3022
- extern struct class spi_slave_class ; /* dummy */
3021
+ extern struct class spi_target_class ; /* dummy */
3023
3022
#endif
3024
3023
3025
3024
/**
3026
- * __spi_alloc_controller - allocate an SPI master or slave controller
3025
+ * __spi_alloc_controller - allocate an SPI host or target controller
3027
3026
* @dev: the controller, possibly using the platform_bus
3028
3027
* @size: how much zeroed driver-private data to allocate; the pointer to this
3029
3028
* memory is in the driver_data field of the returned device, accessible
3030
3029
* with spi_controller_get_devdata(); the memory is cacheline aligned;
3031
3030
* drivers granting DMA access to portions of their private data need to
3032
3031
* 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
3035
3034
* Context: can sleep
3036
3035
*
3037
3036
* This call is used only by SPI controller drivers, which are the
@@ -3048,7 +3047,7 @@ extern struct class spi_slave_class; /* dummy */
3048
3047
* Return: the SPI controller structure on success, else NULL.
3049
3048
*/
3050
3049
struct spi_controller * __spi_alloc_controller (struct device * dev ,
3051
- unsigned int size , bool slave )
3050
+ unsigned int size , bool target )
3052
3051
{
3053
3052
struct spi_controller * ctlr ;
3054
3053
size_t ctlr_size = ALIGN (sizeof (* ctlr ), dma_get_cache_alignment ());
@@ -3069,11 +3068,11 @@ struct spi_controller *__spi_alloc_controller(struct device *dev,
3069
3068
mutex_init (& ctlr -> add_lock );
3070
3069
ctlr -> bus_num = -1 ;
3071
3070
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 ;
3075
3074
else
3076
- ctlr -> dev .class = & spi_master_class ;
3075
+ ctlr -> dev .class = & spi_controller_class ;
3077
3076
ctlr -> dev .parent = dev ;
3078
3077
pm_suspend_ignore_children (& ctlr -> dev , true);
3079
3078
spi_controller_set_devdata (ctlr , (void * )ctlr + ctlr_size );
@@ -3091,7 +3090,7 @@ static void devm_spi_release_controller(struct device *dev, void *ctlr)
3091
3090
* __devm_spi_alloc_controller - resource-managed __spi_alloc_controller()
3092
3091
* @dev: physical device of SPI controller
3093
3092
* @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
3095
3094
* Context: can sleep
3096
3095
*
3097
3096
* 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)
3104
3103
*/
3105
3104
struct spi_controller * __devm_spi_alloc_controller (struct device * dev ,
3106
3105
unsigned int size ,
3107
- bool slave )
3106
+ bool target )
3108
3107
{
3109
3108
struct spi_controller * * ptr , * ctlr ;
3110
3109
@@ -3113,7 +3112,7 @@ struct spi_controller *__devm_spi_alloc_controller(struct device *dev,
3113
3112
if (!ptr )
3114
3113
return NULL ;
3115
3114
3116
- ctlr = __spi_alloc_controller (dev , size , slave );
3115
+ ctlr = __spi_alloc_controller (dev , size , target );
3117
3116
if (ctlr ) {
3118
3117
ctlr -> devm_allocated = true;
3119
3118
* ptr = ctlr ;
@@ -3127,8 +3126,8 @@ struct spi_controller *__devm_spi_alloc_controller(struct device *dev,
3127
3126
EXPORT_SYMBOL_GPL (__devm_spi_alloc_controller );
3128
3127
3129
3128
/**
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
3132
3131
*/
3133
3132
static int spi_get_gpio_descs (struct spi_controller * ctlr )
3134
3133
{
@@ -3226,7 +3225,7 @@ static int spi_controller_id_alloc(struct spi_controller *ctlr, int start, int e
3226
3225
int id ;
3227
3226
3228
3227
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 );
3230
3229
mutex_unlock (& board_lock );
3231
3230
if (WARN (id < 0 , "couldn't get idr" ))
3232
3231
return id == - ENOSPC ? - EBUSY : id ;
@@ -3375,7 +3374,7 @@ int spi_register_controller(struct spi_controller *ctlr)
3375
3374
spi_destroy_queue (ctlr );
3376
3375
free_bus_id :
3377
3376
mutex_lock (& board_lock );
3378
- idr_remove (& spi_master_idr , ctlr -> bus_num );
3377
+ idr_remove (& spi_controller_idr , ctlr -> bus_num );
3379
3378
mutex_unlock (& board_lock );
3380
3379
return status ;
3381
3380
}
@@ -3387,8 +3386,7 @@ static void devm_spi_unregister(struct device *dev, void *res)
3387
3386
}
3388
3387
3389
3388
/**
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
3392
3390
* @dev: device managing SPI controller
3393
3391
* @ctlr: initialized controller, originally from spi_alloc_host() or
3394
3392
* spi_alloc_target()
@@ -3428,7 +3426,7 @@ static int __unregister(struct device *dev, void *null)
3428
3426
}
3429
3427
3430
3428
/**
3431
- * spi_unregister_controller - unregister SPI master or slave controller
3429
+ * spi_unregister_controller - unregister SPI host or target controller
3432
3430
* @ctlr: the controller being unregistered
3433
3431
* Context: can sleep
3434
3432
*
@@ -3452,7 +3450,7 @@ void spi_unregister_controller(struct spi_controller *ctlr)
3452
3450
3453
3451
/* First make sure that this controller was ever added */
3454
3452
mutex_lock (& board_lock );
3455
- found = idr_find (& spi_master_idr , id );
3453
+ found = idr_find (& spi_controller_idr , id );
3456
3454
mutex_unlock (& board_lock );
3457
3455
if (ctlr -> queued ) {
3458
3456
if (spi_destroy_queue (ctlr ))
@@ -3467,7 +3465,7 @@ void spi_unregister_controller(struct spi_controller *ctlr)
3467
3465
/* Free bus id */
3468
3466
mutex_lock (& board_lock );
3469
3467
if (found == ctlr )
3470
- idr_remove (& spi_master_idr , id );
3468
+ idr_remove (& spi_controller_idr , id );
3471
3469
mutex_unlock (& board_lock );
3472
3470
3473
3471
if (IS_ENABLED (CONFIG_SPI_DYNAMIC ))
@@ -4620,7 +4618,7 @@ EXPORT_SYMBOL_GPL(spi_sync_locked);
4620
4618
4621
4619
/**
4622
4620
* 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
4624
4622
* Context: can sleep
4625
4623
*
4626
4624
* This call may only be used from a context that may sleep. The sleep
@@ -4651,7 +4649,7 @@ EXPORT_SYMBOL_GPL(spi_bus_lock);
4651
4649
4652
4650
/**
4653
4651
* 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
4655
4653
* Context: can sleep
4656
4654
*
4657
4655
* 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
4768
4766
{
4769
4767
struct device * dev ;
4770
4768
4771
- dev = class_find_device_by_of_node (& spi_master_class , node );
4769
+ dev = class_find_device_by_of_node (& spi_controller_class , node );
4772
4770
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 );
4774
4772
if (!dev )
4775
4773
return NULL ;
4776
4774
@@ -4850,10 +4848,10 @@ struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev
4850
4848
{
4851
4849
struct device * dev ;
4852
4850
4853
- dev = class_find_device (& spi_master_class , NULL , adev ,
4851
+ dev = class_find_device (& spi_controller_class , NULL , adev ,
4854
4852
spi_acpi_controller_match );
4855
4853
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 ,
4857
4855
spi_acpi_controller_match );
4858
4856
if (!dev )
4859
4857
return NULL ;
@@ -4923,12 +4921,12 @@ static int __init spi_init(void)
4923
4921
if (status < 0 )
4924
4922
goto err1 ;
4925
4923
4926
- status = class_register (& spi_master_class );
4924
+ status = class_register (& spi_controller_class );
4927
4925
if (status < 0 )
4928
4926
goto err2 ;
4929
4927
4930
4928
if (IS_ENABLED (CONFIG_SPI_SLAVE )) {
4931
- status = class_register (& spi_slave_class );
4929
+ status = class_register (& spi_target_class );
4932
4930
if (status < 0 )
4933
4931
goto err3 ;
4934
4932
}
@@ -4941,7 +4939,7 @@ static int __init spi_init(void)
4941
4939
return 0 ;
4942
4940
4943
4941
err3 :
4944
- class_unregister (& spi_master_class );
4942
+ class_unregister (& spi_controller_class );
4945
4943
err2 :
4946
4944
bus_unregister (& spi_bus_type );
4947
4945
err1 :
0 commit comments