Re: [PATCH v1.0 14/16] arcmsr: fix sparse checking error

From: éæé
Date: Mon May 05 2014 - 00:10:45 EST


Hi Dan,

In this patch, there are several replace of call readl() or writel()
by direct access to memory.
Because in main memory, we allocated a block of memory for
post_qbuffer and done_qbuffer.
These memory are access by both of CPU and IOP, they are not hardware registers.
This change will not introduce a bug. I have verified it.

Thanks for your comment.

Regards,
Ching


2014-05-02 17:13 GMT+08:00 Dan Carpenter <dan.carpenter@xxxxxxxxxx>:
> On Wed, Apr 30, 2014 at 07:38:26PM +0800, ching wrote:
>> From: Ching<ching2048@xxxxxxxxxxxx>
>>
>> Fix sparse utility checking errors.
>>
>
> I was expecting that this patch would add __iomem annotations throughout
> but in several places it actually removes calls to readl() and writel()
> as well.
>
>> case ACB_ADAPTER_TYPE_C:{
>> - struct MessageUnit_C *reg = (struct MessageUnit_C *)acb->pmuC;
>> + struct MessageUnit_C __iomem *reg = acb->pmuC;
>> /* disable all outbound interrupt */
>> orig_mask = readl(&reg->host_int_mask); /* disable outbound message0 int */
>> writel(orig_mask|ARCMSR_HBCMU_ALL_INTMASKENABLE, &reg->host_int_mask);v
>> @@ -1085,8 +1085,9 @@ static void arcmsr_done4abort_postqueue(
>> /*clear all outbound posted Q*/
>> writel(ARCMSR_DOORBELL_INT_CLEAR_PATTERN, reg->iop2drv_doorbell); /* clear doorbell interrupt */
>> for (i = 0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) {
>> - if ((flag_ccb = readl(&reg->done_qbuffer[i])) != 0) {
>> - writel(0, &reg->done_qbuffer[i]);
>> + flag_ccb = reg->done_qbuffer[i];
>> + if (flag_ccb != 0) {
>> + reg->done_qbuffer[i] = 0;
>> pARCMSR_CDB = (struct ARCMSR_CDB *)(acb->vir2phy_offset+(flag_ccb << 5));/*frame must be 32 bytes aligned*/
>> pCCB = container_of(pARCMSR_CDB, struct CommandControlBlock, arcmsr_cdb);
>> error = (flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR_MODE0) ? true : false;
>
> I don't know the hardware, but it doesn't even seem to make sense to me.
> if "reg" is an __iomem pointer surely an offset into reg is an iomem
> pointer as well.
>
> I am worried that this introduces a bug.
>
> regards,
> dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/