Patchwork [2/4] s390: Add a mechanism to get the subchannel id.

login
register
mail settings
Submitter Cornelia Huck
Date Aug. 7, 2012, 2:52 p.m.
Message ID <1344351168-2568-3-git-send-email-cornelia.huck@de.ibm.com>
Download mbox | patch
Permalink /patch/175672/
State New
Headers show

Comments

Cornelia Huck - Aug. 7, 2012, 2:52 p.m.
This will be needed by the new virtio-ccw transport.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/include/asm/ccwdev.h |  5 +++++
 drivers/s390/cio/device_ops.c  | 10 ++++++++++
 2 files changed, 15 insertions(+)
Sebastian Ott - Aug. 14, 2012, 8:52 a.m.
On Tue, 7 Aug 2012, Cornelia Huck wrote:
> +/**
> + * ccw_device_get_schid - obtain a subchannel id
> + * @cdev: device to obtain the id for
> + * @schid: where to fill in the values
> + */
> +void ccw_device_get_schid(struct ccw_device *cdev, struct subchannel_id *schid)
> +{
> +	*schid = cdev->private->schid;
> +}
> +EXPORT_SYMBOL(ccw_device_get_schid);

After I gave this some thought I like your version of this function
better. But please use the id of the parent subchannel instead of the
copy in cdev->private (since this will be removed soon). I'll do a
cleanup patch to convert the internal users of the old function to use
the one above.

Regards,
Sebastian
Cornelia Huck - Aug. 14, 2012, 10:38 a.m.
On Tue, 14 Aug 2012 10:52:09 +0200 (CEST)
Sebastian Ott <sebott@linux.vnet.ibm.com> wrote:

> 
> On Tue, 7 Aug 2012, Cornelia Huck wrote:
> > +/**
> > + * ccw_device_get_schid - obtain a subchannel id
> > + * @cdev: device to obtain the id for
> > + * @schid: where to fill in the values
> > + */
> > +void ccw_device_get_schid(struct ccw_device *cdev, struct subchannel_id *schid)
> > +{
> > +	*schid = cdev->private->schid;
> > +}
> > +EXPORT_SYMBOL(ccw_device_get_schid);
> 
> After I gave this some thought I like your version of this function
> better. But please use the id of the parent subchannel instead of the
> copy in cdev->private (since this will be removed soon). I'll do a
> cleanup patch to convert the internal users of the old function to use
> the one above.

Good, will change that (I think we can rely on a ccw device always
having either a real subchannel or the orphanage pseudo subchannel as
parent).

Small taste question: EXPORT_SYMBOL vs EXPORT_SYMBOL_GPL?
Sebastian Ott - Aug. 14, 2012, 10:53 a.m.
On Tue, 14 Aug 2012, Cornelia Huck wrote:
> Sebastian Ott <sebott@linux.vnet.ibm.com> wrote:
> > On Tue, 7 Aug 2012, Cornelia Huck wrote:
> > > +/**
> > > + * ccw_device_get_schid - obtain a subchannel id
> > > + * @cdev: device to obtain the id for
> > > + * @schid: where to fill in the values
> > > + */
> > > +void ccw_device_get_schid(struct ccw_device *cdev, struct subchannel_id *schid)
> > > +{
> > > +	*schid = cdev->private->schid;
> > > +}
> > > +EXPORT_SYMBOL(ccw_device_get_schid);
> > 
> > After I gave this some thought I like your version of this function
> > better. But please use the id of the parent subchannel instead of the
> > copy in cdev->private (since this will be removed soon). I'll do a
> > cleanup patch to convert the internal users of the old function to use
> > the one above.
> 
> Good, will change that (I think we can rely on a ccw device always
> having either a real subchannel or the orphanage pseudo subchannel as
> parent).

Yes you can rely on that.

> 
> Small taste question: EXPORT_SYMBOL vs EXPORT_SYMBOL_GPL?

get_subchannel_id was EXPORT_SYMBOL_GPL since its going to replace this
let's use the _GPL variant.

Regards,
Sebastian

Patch

diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h
index 1cb4bb3..9ad79f7 100644
--- a/arch/s390/include/asm/ccwdev.h
+++ b/arch/s390/include/asm/ccwdev.h
@@ -18,6 +18,9 @@  struct irb;
 struct ccw1;
 struct ccw_dev_id;
 
+/* from asm/schid.h */
+struct subchannel_id;
+
 /* simplified initializers for struct ccw_device:
  * CCW_DEVICE and CCW_DEVICE_DEVTYPE initialize one
  * entry in your MODULE_DEVICE_TABLE and set the match_flag correctly */
@@ -226,5 +229,7 @@  int ccw_device_siosl(struct ccw_device *);
 // FIXME: these have to go
 extern int _ccw_device_get_subchannel_number(struct ccw_device *);
 
+extern void ccw_device_get_schid(struct ccw_device *, struct subchannel_id *);
+
 extern void *ccw_device_get_chp_desc(struct ccw_device *, int);
 #endif /* _S390_CCWDEV_H_ */
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c
index ec7fb6d..a93f4a0 100644
--- a/drivers/s390/cio/device_ops.c
+++ b/drivers/s390/cio/device_ops.c
@@ -763,6 +763,16 @@  _ccw_device_get_subchannel_number(struct ccw_device *cdev)
 	return cdev->private->schid.sch_no;
 }
 
+/**
+ * ccw_device_get_schid - obtain a subchannel id
+ * @cdev: device to obtain the id for
+ * @schid: where to fill in the values
+ */
+void ccw_device_get_schid(struct ccw_device *cdev, struct subchannel_id *schid)
+{
+	*schid = cdev->private->schid;
+}
+EXPORT_SYMBOL(ccw_device_get_schid);
 
 MODULE_LICENSE("GPL");
 EXPORT_SYMBOL(ccw_device_set_options_mask);