Commit 687cb7f2 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

s390/chsc: improve channel path descriptor determination

When we fetch channel path descriptors via chsc we use a suboptimal
struct chsc_scpd and adjust that by casting the response to a generic
chsc_response_struct. Simplify the code by improving struct chsc_scpd.
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: default avatarPeter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent f9773768
...@@ -940,7 +940,6 @@ EXPORT_SYMBOL_GPL(chsc_determine_channel_path_desc); ...@@ -940,7 +940,6 @@ EXPORT_SYMBOL_GPL(chsc_determine_channel_path_desc);
int chsc_determine_base_channel_path_desc(struct chp_id chpid, int chsc_determine_base_channel_path_desc(struct chp_id chpid,
struct channel_path_desc *desc) struct channel_path_desc *desc)
{ {
struct chsc_response_struct *chsc_resp;
struct chsc_scpd *scpd_area; struct chsc_scpd *scpd_area;
unsigned long flags; unsigned long flags;
int ret; int ret;
...@@ -950,8 +949,8 @@ int chsc_determine_base_channel_path_desc(struct chp_id chpid, ...@@ -950,8 +949,8 @@ int chsc_determine_base_channel_path_desc(struct chp_id chpid,
ret = chsc_determine_channel_path_desc(chpid, 0, 0, 0, 0, scpd_area); ret = chsc_determine_channel_path_desc(chpid, 0, 0, 0, 0, scpd_area);
if (ret) if (ret)
goto out; goto out;
chsc_resp = (void *)&scpd_area->response;
memcpy(desc, &chsc_resp->data, sizeof(*desc)); memcpy(desc, scpd_area->data, sizeof(*desc));
out: out:
spin_unlock_irqrestore(&chsc_page_lock, flags); spin_unlock_irqrestore(&chsc_page_lock, flags);
return ret; return ret;
...@@ -960,7 +959,6 @@ int chsc_determine_base_channel_path_desc(struct chp_id chpid, ...@@ -960,7 +959,6 @@ int chsc_determine_base_channel_path_desc(struct chp_id chpid,
int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid, int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
struct channel_path_desc_fmt1 *desc) struct channel_path_desc_fmt1 *desc)
{ {
struct chsc_response_struct *chsc_resp;
struct chsc_scpd *scpd_area; struct chsc_scpd *scpd_area;
unsigned long flags; unsigned long flags;
int ret; int ret;
...@@ -970,8 +968,8 @@ int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid, ...@@ -970,8 +968,8 @@ int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
ret = chsc_determine_channel_path_desc(chpid, 0, 1, 1, 0, scpd_area); ret = chsc_determine_channel_path_desc(chpid, 0, 1, 1, 0, scpd_area);
if (ret) if (ret)
goto out; goto out;
chsc_resp = (void *)&scpd_area->response;
memcpy(desc, &chsc_resp->data, sizeof(*desc)); memcpy(desc, scpd_area->data, sizeof(*desc));
out: out:
spin_unlock_irqrestore(&chsc_page_lock, flags); spin_unlock_irqrestore(&chsc_page_lock, flags);
return ret; return ret;
......
...@@ -112,8 +112,9 @@ struct chsc_scpd { ...@@ -112,8 +112,9 @@ struct chsc_scpd {
u32 last_chpid:8; u32 last_chpid:8;
u32 zeroes1; u32 zeroes1;
struct chsc_header response; struct chsc_header response;
u8 data[PAGE_SIZE - 20]; u32:32;
} __attribute__ ((packed)); u8 data[0];
} __packed;
struct chsc_sda_area { struct chsc_sda_area {
struct chsc_header request; struct chsc_header request;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment