ASoC: Intel: Atom: simplify iomem address and casts
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tue, 24 Jul 2018 21:12:47 +0000 (16:12 -0500)
committerMark Brown <broonie@kernel.org>
Wed, 25 Jul 2018 16:21:18 +0000 (17:21 +0100)
Simplify code and add relevant casts to make Sparse warnings go away

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/atom/sst/sst_drv_interface.c

index 6a8b253c58d254e9cdaf754747801dc3e1c4efb1..5455d6e0ab53cc60271c90f16afaed3689bdf0fd 100644 (file)
@@ -266,17 +266,15 @@ static int sst_cdev_ack(struct device *dev, unsigned int str_id,
        stream->cumm_bytes += bytes;
        dev_dbg(dev, "bytes copied %d inc by %ld\n", stream->cumm_bytes, bytes);
 
-       memcpy_fromio(&fw_tstamp,
-               ((void *)(ctx->mailbox + ctx->tstamp)
-               +(str_id * sizeof(fw_tstamp))),
-               sizeof(fw_tstamp));
+       addr =  ((void __iomem *)(ctx->mailbox + ctx->tstamp)) +
+               (str_id * sizeof(fw_tstamp));
+
+       memcpy_fromio(&fw_tstamp, addr, sizeof(fw_tstamp));
 
        fw_tstamp.bytes_copied = stream->cumm_bytes;
        dev_dbg(dev, "bytes sent to fw %llu inc by %ld\n",
                        fw_tstamp.bytes_copied, bytes);
 
-       addr =  ((void *)(ctx->mailbox + ctx->tstamp)) +
-                       (str_id * sizeof(fw_tstamp));
        offset =  offsetof(struct snd_sst_tstamp, bytes_copied);
        sst_shim_write(addr, offset, fw_tstamp.bytes_copied);
        return 0;
@@ -360,11 +358,12 @@ static int sst_cdev_tstamp(struct device *dev, unsigned int str_id,
        struct snd_sst_tstamp fw_tstamp = {0,};
        struct stream_info *stream;
        struct intel_sst_drv *ctx = dev_get_drvdata(dev);
+       void __iomem *addr;
+
+       addr = (void __iomem *)(ctx->mailbox + ctx->tstamp) +
+               (str_id * sizeof(fw_tstamp));
 
-       memcpy_fromio(&fw_tstamp,
-               ((void *)(ctx->mailbox + ctx->tstamp)
-               +(str_id * sizeof(fw_tstamp))),
-               sizeof(fw_tstamp));
+       memcpy_fromio(&fw_tstamp, addr, sizeof(fw_tstamp));
 
        stream = get_stream_info(ctx, str_id);
        if (!stream)
@@ -530,6 +529,7 @@ static int sst_read_timestamp(struct device *dev, struct pcm_stream_info *info)
        struct snd_sst_tstamp fw_tstamp;
        unsigned int str_id;
        struct intel_sst_drv *ctx = dev_get_drvdata(dev);
+       void __iomem *addr;
 
        str_id = info->str_id;
        stream = get_stream_info(ctx, str_id);
@@ -540,10 +540,11 @@ static int sst_read_timestamp(struct device *dev, struct pcm_stream_info *info)
                return -EINVAL;
        substream = stream->pcm_substream;
 
-       memcpy_fromio(&fw_tstamp,
-               ((void *)(ctx->mailbox + ctx->tstamp)
-                       + (str_id * sizeof(fw_tstamp))),
-               sizeof(fw_tstamp));
+       addr = (void __iomem *)(ctx->mailbox + ctx->tstamp) +
+               (str_id * sizeof(fw_tstamp));
+
+       memcpy_fromio(&fw_tstamp, addr, sizeof(fw_tstamp));
+
        return sst_calc_tstamp(ctx, info, substream, &fw_tstamp);
 }