diff options
author | Julia Lawall <julia@diku.dk> | 2010-05-30 09:49:22 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-27 13:01:29 -0400 |
commit | da2907ffd08a2d708c829ec171f05fe3ceab1315 (patch) | |
tree | 9c0a204817c3fd520b60adb085ede86b811392b3 /drivers/scsi/dpt_i2o.c | |
parent | c0ff2775a1dcbaf2cbe3fb571ae5ea11b63ea590 (diff) |
[SCSI] dpt_i2o: Use GFP_ATOMIC when a lock is held
The function adpt_i2o_post_wait is called from several places, in some of
which, such as adpt_abort, a lock may be held.
The functions adpt_i2o_reparse_lct and adpt_i2o_lct_get are called from
several places, including adpt_rescan where a lock may be held.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@gfp exists@
identifier fn;
position p;
@@
fn(...) {
... when != spin_unlock_irqrestore
when any
GFP_KERNEL@p
... when any
}
@locked@
identifier gfp.fn;
@@
spin_lock_irqsave(...)
... when != spin_unlock_irqrestore
fn(...)
@depends on locked@
position gfp.p;
@@
- GFP_KERNEL@p
+ GFP_ATOMIC
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/dpt_i2o.c')
-rw-r--r-- | drivers/scsi/dpt_i2o.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index b0c576f84b28..f2d4df14c311 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -1290,7 +1290,7 @@ static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout) | |||
1290 | ulong flags = 0; | 1290 | ulong flags = 0; |
1291 | struct adpt_i2o_post_wait_data *p1, *p2; | 1291 | struct adpt_i2o_post_wait_data *p1, *p2; |
1292 | struct adpt_i2o_post_wait_data *wait_data = | 1292 | struct adpt_i2o_post_wait_data *wait_data = |
1293 | kmalloc(sizeof(struct adpt_i2o_post_wait_data),GFP_KERNEL); | 1293 | kmalloc(sizeof(struct adpt_i2o_post_wait_data), GFP_ATOMIC); |
1294 | DECLARE_WAITQUEUE(wait, current); | 1294 | DECLARE_WAITQUEUE(wait, current); |
1295 | 1295 | ||
1296 | if (!wait_data) | 1296 | if (!wait_data) |
@@ -2651,7 +2651,8 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba) | |||
2651 | pDev = pDev->next_lun; | 2651 | pDev = pDev->next_lun; |
2652 | } | 2652 | } |
2653 | if(!pDev ) { // Something new add it | 2653 | if(!pDev ) { // Something new add it |
2654 | d = kmalloc(sizeof(struct i2o_device), GFP_KERNEL); | 2654 | d = kmalloc(sizeof(struct i2o_device), |
2655 | GFP_ATOMIC); | ||
2655 | if(d==NULL) | 2656 | if(d==NULL) |
2656 | { | 2657 | { |
2657 | printk(KERN_CRIT "Out of memory for I2O device data.\n"); | 2658 | printk(KERN_CRIT "Out of memory for I2O device data.\n"); |
@@ -2673,7 +2674,9 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba) | |||
2673 | } | 2674 | } |
2674 | pDev = pHba->channel[bus_no].device[scsi_id]; | 2675 | pDev = pHba->channel[bus_no].device[scsi_id]; |
2675 | if( pDev == NULL){ | 2676 | if( pDev == NULL){ |
2676 | pDev = kzalloc(sizeof(struct adpt_device),GFP_KERNEL); | 2677 | pDev = |
2678 | kzalloc(sizeof(struct adpt_device), | ||
2679 | GFP_ATOMIC); | ||
2677 | if(pDev == NULL) { | 2680 | if(pDev == NULL) { |
2678 | return -ENOMEM; | 2681 | return -ENOMEM; |
2679 | } | 2682 | } |
@@ -2682,7 +2685,9 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba) | |||
2682 | while (pDev->next_lun) { | 2685 | while (pDev->next_lun) { |
2683 | pDev = pDev->next_lun; | 2686 | pDev = pDev->next_lun; |
2684 | } | 2687 | } |
2685 | pDev = pDev->next_lun = kzalloc(sizeof(struct adpt_device),GFP_KERNEL); | 2688 | pDev = pDev->next_lun = |
2689 | kzalloc(sizeof(struct adpt_device), | ||
2690 | GFP_ATOMIC); | ||
2686 | if(pDev == NULL) { | 2691 | if(pDev == NULL) { |
2687 | return -ENOMEM; | 2692 | return -ENOMEM; |
2688 | } | 2693 | } |
@@ -3127,7 +3132,7 @@ static int adpt_i2o_lct_get(adpt_hba* pHba) | |||
3127 | if (pHba->lct == NULL) { | 3132 | if (pHba->lct == NULL) { |
3128 | pHba->lct = dma_alloc_coherent(&pHba->pDev->dev, | 3133 | pHba->lct = dma_alloc_coherent(&pHba->pDev->dev, |
3129 | pHba->lct_size, &pHba->lct_pa, | 3134 | pHba->lct_size, &pHba->lct_pa, |
3130 | GFP_KERNEL); | 3135 | GFP_ATOMIC); |
3131 | if(pHba->lct == NULL) { | 3136 | if(pHba->lct == NULL) { |
3132 | printk(KERN_CRIT "%s: Lct Get failed. Out of memory.\n", | 3137 | printk(KERN_CRIT "%s: Lct Get failed. Out of memory.\n", |
3133 | pHba->name); | 3138 | pHba->name); |