diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2015-06-27 14:20:34 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-06-27 14:20:34 -0400 |
commit | e44ac588cd61c960226d61c379e2873a95544a51 (patch) | |
tree | e508c34c4e42bbc2530ba65466b96e4c26fcd517 /drivers/block | |
parent | 6443af9855dad721375349af036449becc62b632 (diff) |
drivers/block/nvme-core.c: fix build with gcc-4.4.4
gcc-4.4.4 (and possibly other versions) fail the compile when initializers
are used with anonymous unions. Work around this.
drivers/block/nvme-core.c: In function 'nvme_identify_ctrl':
drivers/block/nvme-core.c:1163: error: unknown field 'identify' specified in initializer
drivers/block/nvme-core.c:1163: warning: missing braces around initializer
drivers/block/nvme-core.c:1163: warning: (near initialization for 'c.<anonymous>')
drivers/block/nvme-core.c:1164: error: unknown field 'identify' specified in initializer
drivers/block/nvme-core.c:1164: warning: excess elements in struct initializer
drivers/block/nvme-core.c:1164: warning: (near initialization for 'c')
...
This patch has no effect on text size with gcc-4.8.2.
Fixes: d29ec8241c10eac ("nvme: submit internal commands through the block layer")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@fb.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/nvme-core.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 75a914914c41..34338d7438f5 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -1171,12 +1171,13 @@ static int adapter_delete_sq(struct nvme_dev *dev, u16 sqid) | |||
1171 | 1171 | ||
1172 | int nvme_identify_ctrl(struct nvme_dev *dev, struct nvme_id_ctrl **id) | 1172 | int nvme_identify_ctrl(struct nvme_dev *dev, struct nvme_id_ctrl **id) |
1173 | { | 1173 | { |
1174 | struct nvme_command c = { | 1174 | struct nvme_command c = { }; |
1175 | .identify.opcode = nvme_admin_identify, | ||
1176 | .identify.cns = cpu_to_le32(1), | ||
1177 | }; | ||
1178 | int error; | 1175 | int error; |
1179 | 1176 | ||
1177 | /* gcc-4.4.4 (at least) has issues with initializers and anon unions */ | ||
1178 | c.identify.opcode = nvme_admin_identify; | ||
1179 | c.identify.cns = cpu_to_le32(1); | ||
1180 | |||
1180 | *id = kmalloc(sizeof(struct nvme_id_ctrl), GFP_KERNEL); | 1181 | *id = kmalloc(sizeof(struct nvme_id_ctrl), GFP_KERNEL); |
1181 | if (!*id) | 1182 | if (!*id) |
1182 | return -ENOMEM; | 1183 | return -ENOMEM; |
@@ -1191,12 +1192,13 @@ int nvme_identify_ctrl(struct nvme_dev *dev, struct nvme_id_ctrl **id) | |||
1191 | int nvme_identify_ns(struct nvme_dev *dev, unsigned nsid, | 1192 | int nvme_identify_ns(struct nvme_dev *dev, unsigned nsid, |
1192 | struct nvme_id_ns **id) | 1193 | struct nvme_id_ns **id) |
1193 | { | 1194 | { |
1194 | struct nvme_command c = { | 1195 | struct nvme_command c = { }; |
1195 | .identify.opcode = nvme_admin_identify, | ||
1196 | .identify.nsid = cpu_to_le32(nsid), | ||
1197 | }; | ||
1198 | int error; | 1196 | int error; |
1199 | 1197 | ||
1198 | /* gcc-4.4.4 (at least) has issues with initializers and anon unions */ | ||
1199 | c.identify.opcode = nvme_admin_identify, | ||
1200 | c.identify.nsid = cpu_to_le32(nsid), | ||
1201 | |||
1200 | *id = kmalloc(sizeof(struct nvme_id_ns), GFP_KERNEL); | 1202 | *id = kmalloc(sizeof(struct nvme_id_ns), GFP_KERNEL); |
1201 | if (!*id) | 1203 | if (!*id) |
1202 | return -ENOMEM; | 1204 | return -ENOMEM; |
@@ -1240,14 +1242,14 @@ int nvme_set_features(struct nvme_dev *dev, unsigned fid, unsigned dword11, | |||
1240 | 1242 | ||
1241 | int nvme_get_log_page(struct nvme_dev *dev, struct nvme_smart_log **log) | 1243 | int nvme_get_log_page(struct nvme_dev *dev, struct nvme_smart_log **log) |
1242 | { | 1244 | { |
1243 | struct nvme_command c = { | 1245 | struct nvme_command c = { }; |
1244 | .common.opcode = nvme_admin_get_log_page, | 1246 | int error; |
1245 | .common.nsid = cpu_to_le32(0xFFFFFFFF), | 1247 | |
1246 | .common.cdw10[0] = cpu_to_le32( | 1248 | c.common.opcode = nvme_admin_get_log_page, |
1249 | c.common.nsid = cpu_to_le32(0xFFFFFFFF), | ||
1250 | c.common.cdw10[0] = cpu_to_le32( | ||
1247 | (((sizeof(struct nvme_smart_log) / 4) - 1) << 16) | | 1251 | (((sizeof(struct nvme_smart_log) / 4) - 1) << 16) | |
1248 | NVME_LOG_SMART), | 1252 | NVME_LOG_SMART), |
1249 | }; | ||
1250 | int error; | ||
1251 | 1253 | ||
1252 | *log = kmalloc(sizeof(struct nvme_smart_log), GFP_KERNEL); | 1254 | *log = kmalloc(sizeof(struct nvme_smart_log), GFP_KERNEL); |
1253 | if (!*log) | 1255 | if (!*log) |