Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Sebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Sebastian Ott and committed by
Martin Schwidefsky
687cb7f2 f9773768

+7 -8
+4 -6
drivers/s390/cio/chsc.c
··· 940 940 int chsc_determine_base_channel_path_desc(struct chp_id chpid, 941 941 struct channel_path_desc *desc) 942 942 { 943 - struct chsc_response_struct *chsc_resp; 944 943 struct chsc_scpd *scpd_area; 945 944 unsigned long flags; 946 945 int ret; ··· 949 950 ret = chsc_determine_channel_path_desc(chpid, 0, 0, 0, 0, scpd_area); 950 951 if (ret) 951 952 goto out; 952 - chsc_resp = (void *)&scpd_area->response; 953 - memcpy(desc, &chsc_resp->data, sizeof(*desc)); 953 + 954 + memcpy(desc, scpd_area->data, sizeof(*desc)); 954 955 out: 955 956 spin_unlock_irqrestore(&chsc_page_lock, flags); 956 957 return ret; ··· 959 960 int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid, 960 961 struct channel_path_desc_fmt1 *desc) 961 962 { 962 - struct chsc_response_struct *chsc_resp; 963 963 struct chsc_scpd *scpd_area; 964 964 unsigned long flags; 965 965 int ret; ··· 968 970 ret = chsc_determine_channel_path_desc(chpid, 0, 1, 1, 0, scpd_area); 969 971 if (ret) 970 972 goto out; 971 - chsc_resp = (void *)&scpd_area->response; 972 - memcpy(desc, &chsc_resp->data, sizeof(*desc)); 973 + 974 + memcpy(desc, scpd_area->data, sizeof(*desc)); 973 975 out: 974 976 spin_unlock_irqrestore(&chsc_page_lock, flags); 975 977 return ret;
+3 -2
drivers/s390/cio/chsc.h
··· 112 112 u32 last_chpid:8; 113 113 u32 zeroes1; 114 114 struct chsc_header response; 115 - u8 data[PAGE_SIZE - 20]; 116 - } __attribute__ ((packed)); 115 + u32:32; 116 + u8 data[0]; 117 + } __packed; 117 118 118 119 struct chsc_sda_area { 119 120 struct chsc_header request;