skd: Introduce SKD_SKCOMP_SIZE
authorBart Van Assche <bart.vanassche@wdc.com>
Thu, 17 Aug 2017 20:13:02 +0000 (13:13 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 18 Aug 2017 14:45:29 +0000 (08:45 -0600)
This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/skd_main.c

index 98dc1607307299333fd98e361317bd610fb20270..53090a10150f8af9345d4d48ed4583320876f284 100644 (file)
@@ -103,6 +103,10 @@ MODULE_VERSION(DRV_VERSION "-" DRV_BUILD_ID);
 
 #define SKD_N_INTERNAL_BYTES    (512u)
 
+#define SKD_SKCOMP_SIZE                                                        \
+       ((sizeof(struct fit_completion_entry_v1) +                      \
+         sizeof(struct fit_comp_error_info)) * SKD_N_COMPLETION_ENTRY)
+
 /* 5 bits of uniqifier, 0xF800 */
 #define SKD_ID_INCR             (0x400)
 #define SKD_ID_TABLE_MASK       (3u << 8u)
@@ -2834,13 +2838,7 @@ static void skd_release_special(struct skd_device *skdev,
 
 static void skd_reset_skcomp(struct skd_device *skdev)
 {
-       u32 nbytes;
-       struct fit_completion_entry_v1 *skcomp;
-
-       nbytes = sizeof(*skcomp) * SKD_N_COMPLETION_ENTRY;
-       nbytes += sizeof(struct fit_comp_error_info) * SKD_N_COMPLETION_ENTRY;
-
-       memset(skdev->skcomp_table, 0, nbytes);
+       memset(skdev->skcomp_table, 0, SKD_SKCOMP_SIZE);
 
        skdev->skcomp_ix = 0;
        skdev->skcomp_cycle = 1;
@@ -3851,16 +3849,12 @@ static int skd_cons_skcomp(struct skd_device *skdev)
 {
        int rc = 0;
        struct fit_completion_entry_v1 *skcomp;
-       u32 nbytes;
-
-       nbytes = sizeof(*skcomp) * SKD_N_COMPLETION_ENTRY;
-       nbytes += sizeof(struct fit_comp_error_info) * SKD_N_COMPLETION_ENTRY;
 
        dev_dbg(&skdev->pdev->dev,
-               "comp pci_alloc, total bytes %d entries %d\n",
-               nbytes, SKD_N_COMPLETION_ENTRY);
+               "comp pci_alloc, total bytes %zd entries %d\n",
+               SKD_SKCOMP_SIZE, SKD_N_COMPLETION_ENTRY);
 
-       skcomp = pci_zalloc_consistent(skdev->pdev, nbytes,
+       skcomp = pci_zalloc_consistent(skdev->pdev, SKD_SKCOMP_SIZE,
                                       &skdev->cq_dma_address);
 
        if (skcomp == NULL) {