Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
531558b5
Commit
531558b5
authored
Oct 14, 2021
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'spi-5.15' into spi-5.16
parents
d9c55c95
16a8e2fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
16 deletions
+21
-16
drivers/spi/spi-mux.c
drivers/spi/spi-mux.c
+7
-0
drivers/spi/spi.c
drivers/spi/spi.c
+11
-16
include/linux/spi/spi.h
include/linux/spi/spi.h
+3
-0
No files found.
drivers/spi/spi-mux.c
View file @
531558b5
...
@@ -137,6 +137,13 @@ static int spi_mux_probe(struct spi_device *spi)
...
@@ -137,6 +137,13 @@ static int spi_mux_probe(struct spi_device *spi)
priv
=
spi_controller_get_devdata
(
ctlr
);
priv
=
spi_controller_get_devdata
(
ctlr
);
priv
->
spi
=
spi
;
priv
->
spi
=
spi
;
/*
* Increase lockdep class as these lock are taken while the parent bus
* already holds their instance's lock.
*/
lockdep_set_subclass
(
&
ctlr
->
io_mutex
,
1
);
lockdep_set_subclass
(
&
ctlr
->
add_lock
,
1
);
priv
->
mux
=
devm_mux_control_get
(
&
spi
->
dev
,
NULL
);
priv
->
mux
=
devm_mux_control_get
(
&
spi
->
dev
,
NULL
);
if
(
IS_ERR
(
priv
->
mux
))
{
if
(
IS_ERR
(
priv
->
mux
))
{
ret
=
dev_err_probe
(
&
spi
->
dev
,
PTR_ERR
(
priv
->
mux
),
ret
=
dev_err_probe
(
&
spi
->
dev
,
PTR_ERR
(
priv
->
mux
),
...
...
drivers/spi/spi.c
View file @
531558b5
...
@@ -477,12 +477,6 @@ static LIST_HEAD(spi_controller_list);
...
@@ -477,12 +477,6 @@ static LIST_HEAD(spi_controller_list);
*/
*/
static
DEFINE_MUTEX
(
board_lock
);
static
DEFINE_MUTEX
(
board_lock
);
/*
* Prevents addition of devices with same chip select and
* addition of devices below an unregistering controller.
*/
static
DEFINE_MUTEX
(
spi_add_lock
);
/**
/**
* spi_alloc_device - Allocate a new SPI device
* spi_alloc_device - Allocate a new SPI device
* @ctlr: Controller to which device is connected
* @ctlr: Controller to which device is connected
...
@@ -635,9 +629,9 @@ static int spi_add_device(struct spi_device *spi)
...
@@ -635,9 +629,9 @@ static int spi_add_device(struct spi_device *spi)
/* Set the bus ID string */
/* Set the bus ID string */
spi_dev_set_name
(
spi
);
spi_dev_set_name
(
spi
);
mutex_lock
(
&
spi_
add_lock
);
mutex_lock
(
&
ctlr
->
add_lock
);
status
=
__spi_add_device
(
spi
);
status
=
__spi_add_device
(
spi
);
mutex_unlock
(
&
spi_
add_lock
);
mutex_unlock
(
&
ctlr
->
add_lock
);
return
status
;
return
status
;
}
}
...
@@ -656,7 +650,7 @@ static int spi_add_device_locked(struct spi_device *spi)
...
@@ -656,7 +650,7 @@ static int spi_add_device_locked(struct spi_device *spi)
/* Set the bus ID string */
/* Set the bus ID string */
spi_dev_set_name
(
spi
);
spi_dev_set_name
(
spi
);
WARN_ON
(
!
mutex_is_locked
(
&
spi_
add_lock
));
WARN_ON
(
!
mutex_is_locked
(
&
ctlr
->
add_lock
));
return
__spi_add_device
(
spi
);
return
__spi_add_device
(
spi
);
}
}
...
@@ -2632,6 +2626,12 @@ struct spi_controller *__spi_alloc_controller(struct device *dev,
...
@@ -2632,6 +2626,12 @@ struct spi_controller *__spi_alloc_controller(struct device *dev,
return
NULL
;
return
NULL
;
device_initialize
(
&
ctlr
->
dev
);
device_initialize
(
&
ctlr
->
dev
);
INIT_LIST_HEAD
(
&
ctlr
->
queue
);
spin_lock_init
(
&
ctlr
->
queue_lock
);
spin_lock_init
(
&
ctlr
->
bus_lock_spinlock
);
mutex_init
(
&
ctlr
->
bus_lock_mutex
);
mutex_init
(
&
ctlr
->
io_mutex
);
mutex_init
(
&
ctlr
->
add_lock
);
ctlr
->
bus_num
=
-
1
;
ctlr
->
bus_num
=
-
1
;
ctlr
->
num_chipselect
=
1
;
ctlr
->
num_chipselect
=
1
;
ctlr
->
slave
=
slave
;
ctlr
->
slave
=
slave
;
...
@@ -2904,11 +2904,6 @@ int spi_register_controller(struct spi_controller *ctlr)
...
@@ -2904,11 +2904,6 @@ int spi_register_controller(struct spi_controller *ctlr)
return
id
;
return
id
;
ctlr
->
bus_num
=
id
;
ctlr
->
bus_num
=
id
;
}
}
INIT_LIST_HEAD
(
&
ctlr
->
queue
);
spin_lock_init
(
&
ctlr
->
queue_lock
);
spin_lock_init
(
&
ctlr
->
bus_lock_spinlock
);
mutex_init
(
&
ctlr
->
bus_lock_mutex
);
mutex_init
(
&
ctlr
->
io_mutex
);
ctlr
->
bus_lock_flag
=
0
;
ctlr
->
bus_lock_flag
=
0
;
init_completion
(
&
ctlr
->
xfer_completion
);
init_completion
(
&
ctlr
->
xfer_completion
);
if
(
!
ctlr
->
max_dma_len
)
if
(
!
ctlr
->
max_dma_len
)
...
@@ -3045,7 +3040,7 @@ void spi_unregister_controller(struct spi_controller *ctlr)
...
@@ -3045,7 +3040,7 @@ void spi_unregister_controller(struct spi_controller *ctlr)
/* Prevent addition of new devices, unregister existing ones */
/* Prevent addition of new devices, unregister existing ones */
if
(
IS_ENABLED
(
CONFIG_SPI_DYNAMIC
))
if
(
IS_ENABLED
(
CONFIG_SPI_DYNAMIC
))
mutex_lock
(
&
spi_
add_lock
);
mutex_lock
(
&
ctlr
->
add_lock
);
device_for_each_child
(
&
ctlr
->
dev
,
NULL
,
__unregister
);
device_for_each_child
(
&
ctlr
->
dev
,
NULL
,
__unregister
);
...
@@ -3076,7 +3071,7 @@ void spi_unregister_controller(struct spi_controller *ctlr)
...
@@ -3076,7 +3071,7 @@ void spi_unregister_controller(struct spi_controller *ctlr)
mutex_unlock
(
&
board_lock
);
mutex_unlock
(
&
board_lock
);
if
(
IS_ENABLED
(
CONFIG_SPI_DYNAMIC
))
if
(
IS_ENABLED
(
CONFIG_SPI_DYNAMIC
))
mutex_unlock
(
&
spi_
add_lock
);
mutex_unlock
(
&
ctlr
->
add_lock
);
}
}
EXPORT_SYMBOL_GPL
(
spi_unregister_controller
);
EXPORT_SYMBOL_GPL
(
spi_unregister_controller
);
...
...
include/linux/spi/spi.h
View file @
531558b5
...
@@ -527,6 +527,9 @@ struct spi_controller {
...
@@ -527,6 +527,9 @@ struct spi_controller {
/* I/O mutex */
/* I/O mutex */
struct
mutex
io_mutex
;
struct
mutex
io_mutex
;
/* Used to avoid adding the same CS twice */
struct
mutex
add_lock
;
/* lock and mutex for SPI bus locking */
/* lock and mutex for SPI bus locking */
spinlock_t
bus_lock_spinlock
;
spinlock_t
bus_lock_spinlock
;
struct
mutex
bus_lock_mutex
;
struct
mutex
bus_lock_mutex
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment