Commit 040495d110ba9edc347b3af0e119d1b0d0a8ac87

Authored by Peter Oberparleiter
Committed by Martin Schwidefsky
1 parent cce0eacc22

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>

Showing 1 changed file with 14 additions and 8 deletions Side-by-side Diff

drivers/s390/cio/device_ops.c
... ... @@ -704,9 +704,9 @@
704 704 int ccw_device_get_mdc(struct ccw_device *cdev, u8 mask)
705 705 {
706 706 struct subchannel *sch = to_subchannel(cdev->dev.parent);
707   - struct channel_path_desc_fmt1 desc;
  707 + struct channel_path *chp;
708 708 struct chp_id chpid;
709   - int mdc = 0, ret, i;
  709 + int mdc = 0, i;
710 710  
711 711 /* Adjust requested path mask to excluded varied off paths. */
712 712 if (mask)
713 713  
714 714  
... ... @@ -719,14 +719,20 @@
719 719 if (!(mask & (0x80 >> i)))
720 720 continue;
721 721 chpid.id = sch->schib.pmcw.chpid[i];
722   - ret = chsc_determine_fmt1_channel_path_desc(chpid, &desc);
723   - if (ret)
724   - return ret;
725   - if (!desc.f)
  722 + chp = chpid_to_chp(chpid);
  723 + if (!chp)
  724 + continue;
  725 +
  726 + mutex_lock(&chp->lock);
  727 + if (!chp->desc_fmt1.f) {
  728 + mutex_unlock(&chp->lock);
726 729 return 0;
727   - if (!desc.r)
  730 + }
  731 + if (!chp->desc_fmt1.r)
728 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 738 return mdc;