Skip to content

Commit 449a15d

Browse files
Christoph Hellwigaxboe
authored andcommitted
mtip32xx: remove __force_bit2int
There is no good excuse not to use proper __le16/32 types. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 81e6617 commit 449a15d

File tree

2 files changed

+26
-35
lines changed

2 files changed

+26
-35
lines changed

drivers/block/mtip32xx/mtip32xx.c

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ static void mtip_init_cmd_header(struct request *rq)
181181
(sizeof(struct mtip_cmd_hdr) * rq->tag);
182182

183183
if (test_bit(MTIP_PF_HOST_CAP_64, &dd->port->flags))
184-
cmd->command_header->ctbau = __force_bit2int cpu_to_le32((cmd->command_dma >> 16) >> 16);
184+
cmd->command_header->ctbau = cpu_to_le32((cmd->command_dma >> 16) >> 16);
185185

186-
cmd->command_header->ctba = __force_bit2int cpu_to_le32(cmd->command_dma & 0xFFFFFFFF);
186+
cmd->command_header->ctba = cpu_to_le32(cmd->command_dma & 0xFFFFFFFF);
187187
}
188188

189189
static struct mtip_cmd *mtip_get_int_command(struct driver_data *dd)
@@ -1459,8 +1459,8 @@ static blk_status_t mtip_send_trim(struct driver_data *dd, unsigned int lba,
14591459
tlen = (sect_left >= MTIP_MAX_TRIM_ENTRY_LEN ?
14601460
MTIP_MAX_TRIM_ENTRY_LEN :
14611461
sect_left);
1462-
buf[i].lba = __force_bit2int cpu_to_le32(tlba);
1463-
buf[i].range = __force_bit2int cpu_to_le16(tlen);
1462+
buf[i].lba = cpu_to_le32(tlba);
1463+
buf[i].range = cpu_to_le16(tlen);
14641464
tlba += tlen;
14651465
sect_left -= tlen;
14661466
}
@@ -1590,11 +1590,9 @@ static inline void fill_command_sg(struct driver_data *dd,
15901590
if (dma_len > 0x400000)
15911591
dev_err(&dd->pdev->dev,
15921592
"DMA segment length truncated\n");
1593-
command_sg->info = __force_bit2int
1594-
cpu_to_le32((dma_len-1) & 0x3FFFFF);
1595-
command_sg->dba = __force_bit2int
1596-
cpu_to_le32(sg_dma_address(sg));
1597-
command_sg->dba_upper = __force_bit2int
1593+
command_sg->info = cpu_to_le32((dma_len-1) & 0x3FFFFF);
1594+
command_sg->dba = cpu_to_le32(sg_dma_address(sg));
1595+
command_sg->dba_upper =
15981596
cpu_to_le32((sg_dma_address(sg) >> 16) >> 16);
15991597
command_sg++;
16001598
sg++;
@@ -2231,8 +2229,7 @@ static void mtip_hw_submit_io(struct driver_data *dd, struct request *rq,
22312229

22322230
/* Populate the command header */
22332231
command->command_header->opts =
2234-
__force_bit2int cpu_to_le32(
2235-
(nents << 16) | 5 | AHCI_CMD_PREFETCH);
2232+
cpu_to_le32((nents << 16) | 5 | AHCI_CMD_PREFETCH);
22362233
command->command_header->byte_count = 0;
22372234

22382235
command->direction = dma_dir;
@@ -3586,20 +3583,16 @@ static blk_status_t mtip_issue_reserved_cmd(struct blk_mq_hw_ctx *hctx,
35863583
return BLK_STS_RESOURCE;
35873584

35883585
/* Populate the SG list */
3589-
cmd->command_header->opts =
3590-
__force_bit2int cpu_to_le32(icmd->opts | icmd->fis_len);
3586+
cmd->command_header->opts = cpu_to_le32(icmd->opts | icmd->fis_len);
35913587
if (icmd->buf_len) {
35923588
command_sg = cmd->command + AHCI_CMD_TBL_HDR_SZ;
35933589

3594-
command_sg->info =
3595-
__force_bit2int cpu_to_le32((icmd->buf_len-1) & 0x3FFFFF);
3596-
command_sg->dba =
3597-
__force_bit2int cpu_to_le32(icmd->buffer & 0xFFFFFFFF);
3590+
command_sg->info = cpu_to_le32((icmd->buf_len-1) & 0x3FFFFF);
3591+
command_sg->dba = cpu_to_le32(icmd->buffer & 0xFFFFFFFF);
35983592
command_sg->dba_upper =
3599-
__force_bit2int cpu_to_le32((icmd->buffer >> 16) >> 16);
3593+
cpu_to_le32((icmd->buffer >> 16) >> 16);
36003594

3601-
cmd->command_header->opts |=
3602-
__force_bit2int cpu_to_le32((1 << 16));
3595+
cmd->command_header->opts |= cpu_to_le32((1 << 16));
36033596
}
36043597

36053598
/* Populate the command header */

drivers/block/mtip32xx/mtip32xx.h

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@
126126

127127
#define MTIP_DFS_MAX_BUF_SIZE 1024
128128

129-
#define __force_bit2int (unsigned int __force)
130-
131129
enum {
132130
/* below are bit numbers in 'flags' defined in mtip_port */
133131
MTIP_PF_IC_ACTIVE_BIT = 0, /* pio/ioctl */
@@ -200,9 +198,9 @@ struct mtip_work {
200198
#define MTIP_MAX_TRIM_ENTRY_LEN 0xfff8
201199

202200
struct mtip_trim_entry {
203-
u32 lba; /* starting lba of region */
204-
u16 rsvd; /* unused */
205-
u16 range; /* # of 512b blocks to trim */
201+
__le32 lba; /* starting lba of region */
202+
__le16 rsvd; /* unused */
203+
__le16 range; /* # of 512b blocks to trim */
206204
} __packed;
207205

208206
struct mtip_trim {
@@ -278,24 +276,24 @@ struct mtip_cmd_hdr {
278276
* - Bit 5 Unused in this implementation.
279277
* - Bits 4:0 Length of the command FIS in DWords (DWord = 4 bytes).
280278
*/
281-
unsigned int opts;
279+
__le32 opts;
282280
/* This field is unsed when using NCQ. */
283281
union {
284-
unsigned int byte_count;
285-
unsigned int status;
282+
__le32 byte_count;
283+
__le32 status;
286284
};
287285
/*
288286
* Lower 32 bits of the command table address associated with this
289287
* header. The command table addresses must be 128 byte aligned.
290288
*/
291-
unsigned int ctba;
289+
__le32 ctba;
292290
/*
293291
* If 64 bit addressing is used this field is the upper 32 bits
294292
* of the command table address associated with this command.
295293
*/
296-
unsigned int ctbau;
294+
__le32 ctbau;
297295
/* Reserved and unused. */
298-
unsigned int res[4];
296+
u32 res[4];
299297
};
300298

301299
/* Command scatter gather structure (PRD). */
@@ -305,21 +303,21 @@ struct mtip_cmd_sg {
305303
* address must be 8 byte aligned signified by bits 2:0 being
306304
* set to 0.
307305
*/
308-
unsigned int dba;
306+
__le32 dba;
309307
/*
310308
* When 64 bit addressing is used this field is the upper
311309
* 32 bits of the data buffer address.
312310
*/
313-
unsigned int dba_upper;
311+
__le32 dba_upper;
314312
/* Unused. */
315-
unsigned int reserved;
313+
__le32 reserved;
316314
/*
317315
* Bit 31: interrupt when this data block has been transferred.
318316
* Bits 30..22: reserved
319317
* Bits 21..0: byte count (minus 1). For P320 the byte count must be
320318
* 8 byte aligned signified by bits 2:0 being set to 1.
321319
*/
322-
unsigned int info;
320+
__le32 info;
323321
};
324322
struct mtip_port;
325323

0 commit comments

Comments
 (0)