aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Oberparleiter <peter.oberparleiter@de.ibm.com>2013-03-11 08:01:08 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-04-17 08:07:26 -0400
commit040495d110ba9edc347b3af0e119d1b0d0a8ac87 (patch)
tree311bc7d11f261d00054ef21b11b82893519ff283
parentcce0eacc225b402824e2fc72936b3796e7659fc6 (diff)
s390/cio: make use of newly added format 1 channel-path data
Make use of the stored copy of format 1 channel-path data instead of querying the information every time the corresponding function is called. Reviewed-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--drivers/s390/cio/device_ops.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c
index c77b6e06bf64..4845d64f2842 100644
--- a/drivers/s390/cio/device_ops.c
+++ b/drivers/s390/cio/device_ops.c
@@ -704,9 +704,9 @@ EXPORT_SYMBOL(ccw_device_tm_start_timeout);
704int ccw_device_get_mdc(struct ccw_device *cdev, u8 mask) 704int ccw_device_get_mdc(struct ccw_device *cdev, u8 mask)
705{ 705{
706 struct subchannel *sch = to_subchannel(cdev->dev.parent); 706 struct subchannel *sch = to_subchannel(cdev->dev.parent);
707 struct channel_path_desc_fmt1 desc; 707 struct channel_path *chp;
708 struct chp_id chpid; 708 struct chp_id chpid;
709 int mdc = 0, ret, i; 709 int mdc = 0, i;
710 710
711 /* Adjust requested path mask to excluded varied off paths. */ 711 /* Adjust requested path mask to excluded varied off paths. */
712 if (mask) 712 if (mask)
@@ -719,14 +719,20 @@ int ccw_device_get_mdc(struct ccw_device *cdev, u8 mask)
719 if (!(mask & (0x80 >> i))) 719 if (!(mask & (0x80 >> i)))
720 continue; 720 continue;
721 chpid.id = sch->schib.pmcw.chpid[i]; 721 chpid.id = sch->schib.pmcw.chpid[i];
722 ret = chsc_determine_fmt1_channel_path_desc(chpid, &desc); 722 chp = chpid_to_chp(chpid);
723 if (ret) 723 if (!chp)
724 return ret; 724 continue;
725 if (!desc.f) 725
726 mutex_lock(&chp->lock);
727 if (!chp->desc_fmt1.f) {
728 mutex_unlock(&chp->lock);
726 return 0; 729 return 0;
727 if (!desc.r) 730 }
731 if (!chp->desc_fmt1.r)
728 mdc = 1; 732 mdc = 1;
729 mdc = mdc ? min(mdc, (int)desc.mdc) : desc.mdc; 733 mdc = mdc ? min_t(int, mdc, chp->desc_fmt1.mdc) :
734 chp->desc_fmt1.mdc;
735 mutex_unlock(&chp->lock);
730 } 736 }
731 737
732 return mdc; 738 return mdc;