X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fs390%2Fcio%2Fchsc.c;fp=drivers%2Fs390%2Fcio%2Fchsc.c;h=c28444af0919f91df78cc5dde29d58ca87be05ee;hb=16c70f8c1b54b61c3b951b6fb220df250fe09b32;hp=72187e54dcac79353107616bac3fb1aec3f1b4d0;hpb=4e76c8a9fa413ccc09d3f7f664183dcce3555d57;p=linux-2.6.git diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 72187e54d..c28444af0 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c @@ -10,7 +10,6 @@ */ #include -#include #include #include #include @@ -239,13 +238,10 @@ s390_subchannel_remove_chpid(struct device *dev, void *data) /* Check for single path devices. */ if (sch->schib.pmcw.pim == 0x80) goto out_unreg; - if (sch->vpm == mask) - goto out_unreg; if ((sch->schib.scsw.actl & SCSW_ACTL_DEVACT) && (sch->schib.scsw.actl & SCSW_ACTL_SCHACT) && - (sch->schib.pmcw.lpum == mask) && - (sch->vpm == 0)) { + (sch->schib.pmcw.lpum == mask)) { int cc; cc = cio_clear(sch); @@ -260,6 +256,8 @@ s390_subchannel_remove_chpid(struct device *dev, void *data) /* trigger path verification. */ if (sch->driver && sch->driver->verify) sch->driver->verify(&sch->dev); + else if (sch->vpm == mask) + goto out_unreg; out_unlock: spin_unlock_irq(&sch->lock); return 0; @@ -918,12 +916,13 @@ chp_measurement_read(struct kobject *kobj, char *buf, loff_t off, size_t count) chp = to_channelpath(container_of(kobj, struct device, kobj)); css = to_css(chp->dev.parent); - size = sizeof(struct cmg_chars); + size = sizeof(struct cmg_entry); /* Only allow single reads. */ if (off || count < size) return 0; chp_measurement_copy_block((struct cmg_entry *)buf, css, chp->id); + count = size; return count; } @@ -1392,10 +1391,8 @@ new_channel_path(int chpid) /* fill in status, etc. */ chp->id = chpid; chp->state = 1; - chp->dev = (struct device) { - .parent = &css[0]->device, - .release = chp_release, - }; + chp->dev.parent = &css[0]->device; + chp->dev.release = chp_release; snprintf(chp->dev.bus_id, BUS_ID_SIZE, "chp0.%x", chpid); /* Obtain channel path description and fill it in. */ @@ -1465,6 +1462,40 @@ chsc_get_chp_desc(struct subchannel *sch, int chp_no) return desc; } +static int reset_channel_path(struct channel_path *chp) +{ + int cc; + + cc = rchp(chp->id); + switch (cc) { + case 0: + return 0; + case 2: + return -EBUSY; + default: + return -ENODEV; + } +} + +static void reset_channel_paths_css(struct channel_subsystem *css) +{ + int i; + + for (i = 0; i <= __MAX_CHPID; i++) { + if (css->chps[i]) + reset_channel_path(css->chps[i]); + } +} + +void cio_reset_channel_paths(void) +{ + int i; + + for (i = 0; i <= __MAX_CSSID; i++) { + if (css[i] && css[i]->valid) + reset_channel_paths_css(css[i]); + } +} static int __init chsc_alloc_sei_area(void)