Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci-2.6.23
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci-2.6.23
Commits
6a8a8e14
Commit
6a8a8e14
authored
Mar 21, 2006
by
Tony Luck
Browse files
Options
Browse Files
Download
Plain Diff
Pull sem2mutex-ioc4 into release branch
parents
33cbd30e
6e586f32
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
23 deletions
+18
-23
drivers/sn/ioc4.c
drivers/sn/ioc4.c
+18
-23
No files found.
drivers/sn/ioc4.c
View file @
6a8a8e14
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#include <linux/ioc4.h>
#include <linux/ioc4.h>
#include <linux/mmtimer.h>
#include <linux/mmtimer.h>
#include <linux/rtc.h>
#include <linux/rtc.h>
#include <linux/
rwsem
.h>
#include <linux/
mutex
.h>
#include <asm/sn/addrs.h>
#include <asm/sn/addrs.h>
#include <asm/sn/clksupport.h>
#include <asm/sn/clksupport.h>
#include <asm/sn/shub_mmr.h>
#include <asm/sn/shub_mmr.h>
...
@@ -54,11 +54,10 @@
...
@@ -54,11 +54,10 @@
* Submodule management *
* Submodule management *
************************/
************************/
static
LIST_HEAD
(
ioc4_devices
);
static
DEFINE_MUTEX
(
ioc4_mutex
);
static
DECLARE_RWSEM
(
ioc4_devices_rwsem
);
static
LIST_HEAD
(
ioc4_devices
);
static
LIST_HEAD
(
ioc4_submodules
);
static
LIST_HEAD
(
ioc4_submodules
);
static
DECLARE_RWSEM
(
ioc4_submodules_rwsem
);
/* Register an IOC4 submodule */
/* Register an IOC4 submodule */
int
int
...
@@ -66,15 +65,13 @@ ioc4_register_submodule(struct ioc4_submodule *is)
...
@@ -66,15 +65,13 @@ ioc4_register_submodule(struct ioc4_submodule *is)
{
{
struct
ioc4_driver_data
*
idd
;
struct
ioc4_driver_data
*
idd
;
down_write
(
&
ioc4_submodules_rwsem
);
mutex_lock
(
&
ioc4_mutex
);
list_add
(
&
is
->
is_list
,
&
ioc4_submodules
);
list_add
(
&
is
->
is_list
,
&
ioc4_submodules
);
up_write
(
&
ioc4_submodules_rwsem
);
/* Initialize submodule for each IOC4 */
/* Initialize submodule for each IOC4 */
if
(
!
is
->
is_probe
)
if
(
!
is
->
is_probe
)
return
0
;
goto
out
;
down_read
(
&
ioc4_devices_rwsem
);
list_for_each_entry
(
idd
,
&
ioc4_devices
,
idd_list
)
{
list_for_each_entry
(
idd
,
&
ioc4_devices
,
idd_list
)
{
if
(
is
->
is_probe
(
idd
))
{
if
(
is
->
is_probe
(
idd
))
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
...
@@ -84,8 +81,8 @@ ioc4_register_submodule(struct ioc4_submodule *is)
...
@@ -84,8 +81,8 @@ ioc4_register_submodule(struct ioc4_submodule *is)
pci_name
(
idd
->
idd_pdev
));
pci_name
(
idd
->
idd_pdev
));
}
}
}
}
up_read
(
&
ioc4_devices_rwsem
);
out:
mutex_unlock
(
&
ioc4_mutex
);
return
0
;
return
0
;
}
}
...
@@ -95,15 +92,13 @@ ioc4_unregister_submodule(struct ioc4_submodule *is)
...
@@ -95,15 +92,13 @@ ioc4_unregister_submodule(struct ioc4_submodule *is)
{
{
struct
ioc4_driver_data
*
idd
;
struct
ioc4_driver_data
*
idd
;
down_write
(
&
ioc4_submodules_rwsem
);
mutex_lock
(
&
ioc4_mutex
);
list_del
(
&
is
->
is_list
);
list_del
(
&
is
->
is_list
);
up_write
(
&
ioc4_submodules_rwsem
);
/* Remove submodule for each IOC4 */
/* Remove submodule for each IOC4 */
if
(
!
is
->
is_remove
)
if
(
!
is
->
is_remove
)
return
;
goto
out
;
down_read
(
&
ioc4_devices_rwsem
);
list_for_each_entry
(
idd
,
&
ioc4_devices
,
idd_list
)
{
list_for_each_entry
(
idd
,
&
ioc4_devices
,
idd_list
)
{
if
(
is
->
is_remove
(
idd
))
{
if
(
is
->
is_remove
(
idd
))
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
...
@@ -113,7 +108,8 @@ ioc4_unregister_submodule(struct ioc4_submodule *is)
...
@@ -113,7 +108,8 @@ ioc4_unregister_submodule(struct ioc4_submodule *is)
pci_name
(
idd
->
idd_pdev
));
pci_name
(
idd
->
idd_pdev
));
}
}
}
}
up_read
(
&
ioc4_devices_rwsem
);
out:
mutex_unlock
(
&
ioc4_mutex
);
}
}
/*********************
/*********************
...
@@ -312,12 +308,11 @@ ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
...
@@ -312,12 +308,11 @@ ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
/* Track PCI-device specific data */
/* Track PCI-device specific data */
idd
->
idd_serial_data
=
NULL
;
idd
->
idd_serial_data
=
NULL
;
pci_set_drvdata
(
idd
->
idd_pdev
,
idd
);
pci_set_drvdata
(
idd
->
idd_pdev
,
idd
);
down_write
(
&
ioc4_devices_rwsem
);
mutex_lock
(
&
ioc4_mutex
);
list_add
(
&
idd
->
idd_list
,
&
ioc4_devices
);
list_add
(
&
idd
->
idd_list
,
&
ioc4_devices
);
up_write
(
&
ioc4_devices_rwsem
);
/* Add this IOC4 to all submodules */
/* Add this IOC4 to all submodules */
down_read
(
&
ioc4_submodules_rwsem
);
list_for_each_entry
(
is
,
&
ioc4_submodules
,
is_list
)
{
list_for_each_entry
(
is
,
&
ioc4_submodules
,
is_list
)
{
if
(
is
->
is_probe
&&
is
->
is_probe
(
idd
))
{
if
(
is
->
is_probe
&&
is
->
is_probe
(
idd
))
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
...
@@ -327,7 +322,7 @@ ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
...
@@ -327,7 +322,7 @@ ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
pci_name
(
idd
->
idd_pdev
));
pci_name
(
idd
->
idd_pdev
));
}
}
}
}
up_read
(
&
ioc4_submodules_rwsem
);
mutex_unlock
(
&
ioc4_mutex
);
return
0
;
return
0
;
...
@@ -351,7 +346,7 @@ ioc4_remove(struct pci_dev *pdev)
...
@@ -351,7 +346,7 @@ ioc4_remove(struct pci_dev *pdev)
idd
=
pci_get_drvdata
(
pdev
);
idd
=
pci_get_drvdata
(
pdev
);
/* Remove this IOC4 from all submodules */
/* Remove this IOC4 from all submodules */
down_read
(
&
ioc4_submodules_rwsem
);
mutex_lock
(
&
ioc4_mutex
);
list_for_each_entry
(
is
,
&
ioc4_submodules
,
is_list
)
{
list_for_each_entry
(
is
,
&
ioc4_submodules
,
is_list
)
{
if
(
is
->
is_remove
&&
is
->
is_remove
(
idd
))
{
if
(
is
->
is_remove
&&
is
->
is_remove
(
idd
))
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
...
@@ -361,7 +356,7 @@ ioc4_remove(struct pci_dev *pdev)
...
@@ -361,7 +356,7 @@ ioc4_remove(struct pci_dev *pdev)
pci_name
(
idd
->
idd_pdev
));
pci_name
(
idd
->
idd_pdev
));
}
}
}
}
up_read
(
&
ioc4_submodules_rwsem
);
mutex_unlock
(
&
ioc4_mutex
);
/* Release resources */
/* Release resources */
iounmap
(
idd
->
idd_misc_regs
);
iounmap
(
idd
->
idd_misc_regs
);
...
@@ -377,9 +372,9 @@ ioc4_remove(struct pci_dev *pdev)
...
@@ -377,9 +372,9 @@ ioc4_remove(struct pci_dev *pdev)
pci_disable_device
(
pdev
);
pci_disable_device
(
pdev
);
/* Remove and free driver data */
/* Remove and free driver data */
down_write
(
&
ioc4_devices_rwsem
);
mutex_lock
(
&
ioc4_mutex
);
list_del
(
&
idd
->
idd_list
);
list_del
(
&
idd
->
idd_list
);
up_write
(
&
ioc4_devices_rwsem
);
mutex_unlock
(
&
ioc4_mutex
);
kfree
(
idd
);
kfree
(
idd
);
}
}
...
...
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