>
>
>On 20-12-14 13:03:44, Pawel Laszczak wrote:
>> Patch fixes all sparse warnings in cdsnp driver.
>>
>> It fixes the following warnings:
>> cdnsp-ring.c:1441: warning: incorrect type in assignment
>> cdnsp-ring.c:1444: warning: restricted __le32 degrades to integer
>> cdnsp-ring.c:2200: warning: dubious: x | !y
>> cdnsp-gadget.c:501: warning: incorrect type in assignment
>> cdnsp-gadget.c:504: warning: restricted __le32 degrades to integer
>> cdnsp-gadget.c:507: warning: restricted __le32 degrades to integer
>> cdnsp-gadget.c:508: warning: restricted __le32 degrades to integer
>> cdnsp-gadget.c:509: warning: invalid assignment: |=
>> cdnsp-gadget.c:510: warning: cast from restricted __le32
>> cdnsp-gadget.c:558: warning: incorrect type in assignment
>> cdnsp-gadget.c:561: warning: restricted __le32 degrades to integer
>> cdnsp-gadget.c:570: warning: restricted __le32 degrades to integer
>> cdnsp-gadget.c:1571: warning: incorrect type in argument 1
>> cdnsp-gadget.c:1602: warning: restricted __le32 degrades to integer
>> cdnsp-gadget.c:1760: warning: incorrect type in assignment
>> cdnsp-gadget.c:1762: warning: incorrect type in assignment
>> cdnsp-gadget.c:1763: warning: incorrect type in assignment
>> cdnsp-gadget.c:1764: warning: incorrect type in assignment
>> cdnsp-gadget.c:1765: warning: incorrect type in assignment
>> cdnsp-gadget.c:1766: warning: incorrect type in assignment
>> cdnsp-gadget.c:1767: warning: incorrect type in assignment
>> cdnsp-gadget.c:458: warning: cast truncates bits from constant value
>>                     (ffffffff07ffffff becomes 7ffffff)
>> cdnsp-gadget.c:666: warning: cast truncates bits from constant value
>>                     (ffffffff07ffffff becomes 7ffffff)
>> cdnsp-mem.c:762: warning: incorrect type in assignment
>> cdnsp-mem.c:763: warning: incorrect type in assignment
>> cdnsp-mem.c:928: warning: cast from restricted __le16
>> cdnsp-mem.c:1187: warning: incorrect type in assignment
>> cdnsp-mem.c:1191: warning: incorrect type in assignment
>> cdnsp-ep0.c:142: warning: incorrect type in assignment
>> cdnsp-ep0.c:144: warning: restricted __le32 degrades to integer
>> cdnsp-ep0.c:147: warning: restricted __le32 degrades to integer
>> cdnsp-ep0.c:148: warning: restricted __le32 degrades to integer
>> cdnsp-ep0.c:179: warning: incorrect type in argument 1
>> cdnsp-ep0.c:311: warning: incorrect type in argument 1
>> cdnsp-ep0.c:469: warning: incorrect type in assignment
>> cdnsp-trace.h:611:1: warning: cast from restricted __le32
>>
>> Signed-off-by: Pawel Laszczak <paw...@cadence.com>
>> Reported-by: kernel test robot <l...@intel.com>
>
>Hi Pawel,
>
>The Reported-by tag should be above your Sob tag, I will change it.
>Except the patch reported build error by kernel test robot, I will apply
>your other four patches after finishing the compile test.
>
>Peter

Hi Peter,

I'm going to fix the "usb: cdns3: Adds missing __iomem markers"  today.
I haven't  seen any issue on ARCH=parisc. Maybe it's some specific riscv arch 
issue.

I believe that:
[auto build test WARNING on next-20201211]
[cannot apply to peter.chen-usb/ci-for-usb-next v5.10 v5.10-rc7 v5.10-rc6 v5.10]

is not the problem. I based on  peter.chen-usb/for-usb-next.

Also I can't open the url from kernel test robot report.
Maybe there is some temporary issue with server. 

Thanks,
Pawel

>> ---
>>  drivers/usb/cdns3/cdnsp-debug.h  |  2 +-
>>  drivers/usb/cdns3/cdnsp-ep0.c    | 13 ++++++-------
>>  drivers/usb/cdns3/cdnsp-gadget.c | 24 +++++++++---------------
>>  drivers/usb/cdns3/cdnsp-gadget.h | 13 +++++++------
>>  drivers/usb/cdns3/cdnsp-mem.c    | 11 ++++++-----
>>  drivers/usb/cdns3/cdnsp-ring.c   |  4 ++--
>>  drivers/usb/cdns3/cdnsp-trace.h  |  2 +-
>>  7 files changed, 32 insertions(+), 37 deletions(-)
>>
>> diff --git a/drivers/usb/cdns3/cdnsp-debug.h 
>> b/drivers/usb/cdns3/cdnsp-debug.h
>> index d6345d4d2911..a8776df2d4e0 100644
>> --- a/drivers/usb/cdns3/cdnsp-debug.h
>> +++ b/drivers/usb/cdns3/cdnsp-debug.h
>> @@ -414,7 +414,7 @@ static inline const char *cdnsp_decode_slot_context(u32 
>> info, u32 info2,
>>              s = "UNKNOWN speed";
>>      }
>>
>> -    ret = sprintf(str, "%s Ctx Entries %ld",
>> +    ret = sprintf(str, "%s Ctx Entries %d",
>>                    s, (info & LAST_CTX_MASK) >> 27);
>>
>>      ret += sprintf(str + ret, " [Intr %ld] Addr %ld State %s",
>> diff --git a/drivers/usb/cdns3/cdnsp-ep0.c b/drivers/usb/cdns3/cdnsp-ep0.c
>> index d55b59ed7381..e2b1bcb3f80e 100644
>> --- a/drivers/usb/cdns3/cdnsp-ep0.c
>> +++ b/drivers/usb/cdns3/cdnsp-ep0.c
>> @@ -137,10 +137,8 @@ int cdnsp_status_stage(struct cdnsp_device *pdev)
>>      return cdnsp_ep_enqueue(pdev->ep0_preq.pep, &pdev->ep0_preq);
>>  }
>>
>> -static int cdnsp_w_index_to_ep_index(__le32  wIndex)
>> +static int cdnsp_w_index_to_ep_index(u16 wIndex)
>>  {
>> -    wIndex = le32_to_cpu(wIndex);
>> -
>>      if (!(wIndex & USB_ENDPOINT_NUMBER_MASK))
>>              return 0;
>>
>> @@ -176,7 +174,8 @@ static int cdnsp_ep0_handle_status(struct cdnsp_device 
>> *pdev,
>>               */
>>              return cdnsp_ep0_delegate_req(pdev, ctrl);
>>      case USB_RECIP_ENDPOINT:
>> -            pep = &pdev->eps[cdnsp_w_index_to_ep_index(ctrl->wIndex)];
>> +            ep_sts = cdnsp_w_index_to_ep_index(le16_to_cpu(ctrl->wIndex));
>> +            pep = &pdev->eps[ep_sts];
>>              ep_sts = GET_EP_CTX_STATE(pep->out_ctx);
>>
>>              /* check if endpoint is stalled */
>> @@ -305,10 +304,10 @@ static int cdnsp_ep0_handle_feature_endpoint(struct 
>> cdnsp_device *pdev,
>>                                           int set)
>>  {
>>      struct cdnsp_ep *pep;
>> -    u32 wValue;
>> +    u16 wValue;
>>
>>      wValue = le16_to_cpu(ctrl->wValue);
>> -    pep = &pdev->eps[cdnsp_w_index_to_ep_index(ctrl->wIndex)];
>> +    pep = &pdev->eps[cdnsp_w_index_to_ep_index(le16_to_cpu(ctrl->wIndex))];
>>
>>      switch (wValue) {
>>      case USB_ENDPOINT_HALT:
>> @@ -435,7 +434,7 @@ void cdnsp_setup_analyze(struct cdnsp_device *pdev)
>>  {
>>      struct usb_ctrlrequest *ctrl = &pdev->setup;
>>      int ret = 0;
>> -    __le16 len;
>> +    u16 len;
>>
>>      trace_cdnsp_ctrl_req(ctrl);
>>
>> diff --git a/drivers/usb/cdns3/cdnsp-gadget.c 
>> b/drivers/usb/cdns3/cdnsp-gadget.c
>> index 1668f72fdf30..f28f1508f049 100644
>> --- a/drivers/usb/cdns3/cdnsp-gadget.c
>> +++ b/drivers/usb/cdns3/cdnsp-gadget.c
>> @@ -491,7 +491,7 @@ static void cdnsp_invalidate_ep_events(struct 
>> cdnsp_device *pdev,
>>      struct cdnsp_segment *segment;
>>      union cdnsp_trb *event;
>>      u32 cycle_state;
>> -    __le32  data;
>> +    u32  data;
>>
>>      event = pdev->event_ring->dequeue;
>>      segment = pdev->event_ring->deq_seg;
>> @@ -527,9 +527,9 @@ int cdnsp_wait_for_cmd_compl(struct cdnsp_device *pdev)
>>      dma_addr_t cmd_deq_dma;
>>      union cdnsp_trb *event;
>>      u32 cycle_state;
>> -    __le32  flags;
>>      int ret, val;
>>      u64 cmd_dma;
>> +    u32  flags;
>>
>>      cmd_trb = pdev->cmd.command_trb;
>>      pdev->cmd.status = 0;
>> @@ -1568,7 +1568,7 @@ static void cdnsp_get_ep_buffering(struct cdnsp_device 
>> *pdev,
>>              return;
>>      }
>>
>> -    endpoints = HCS_ENDPOINTS(readl(&pdev->hcs_params1)) / 2;
>> +    endpoints = HCS_ENDPOINTS(pdev->hcs_params1) / 2;
>>
>>      /* Set to XBUF_TX_TAG_MASK_0 register. */
>>      reg += XBUF_TX_CMD_OFFSET + (endpoints * 2 + 2) * sizeof(u32);
>> @@ -1754,22 +1754,16 @@ void cdnsp_irq_reset(struct cdnsp_device *pdev)
>>  static void cdnsp_get_rev_cap(struct cdnsp_device *pdev)
>>  {
>>      void __iomem *reg = &pdev->cap_regs->hc_capbase;
>> -    struct cdnsp_rev_cap *rev_cap;
>>
>>      reg += cdnsp_find_next_ext_cap(reg, 0, RTL_REV_CAP);
>> -    rev_cap = reg;
>> -
>> -    pdev->rev_cap.ctrl_revision = readl(&rev_cap->ctrl_revision);
>> -    pdev->rev_cap.rtl_revision = readl(&rev_cap->rtl_revision);
>> -    pdev->rev_cap.ep_supported = readl(&rev_cap->ep_supported);
>> -    pdev->rev_cap.ext_cap = readl(&rev_cap->ext_cap);
>> -    pdev->rev_cap.rx_buff_size = readl(&rev_cap->rx_buff_size);
>> -    pdev->rev_cap.tx_buff_size = readl(&rev_cap->tx_buff_size);
>> +    pdev->rev_cap  = reg;
>>
>>      dev_info(pdev->dev, "Rev: %08x/%08x, eps: %08x, buff: %08x/%08x\n",
>> -             pdev->rev_cap.ctrl_revision, pdev->rev_cap.rtl_revision,
>> -             pdev->rev_cap.ep_supported, pdev->rev_cap.rx_buff_size,
>> -             pdev->rev_cap.tx_buff_size);
>> +             readl(&pdev->rev_cap->ctrl_revision),
>> +             readl(&pdev->rev_cap->rtl_revision),
>> +             readl(&pdev->rev_cap->ep_supported),
>> +             readl(&pdev->rev_cap->rx_buff_size),
>> +             readl(&pdev->rev_cap->tx_buff_size));
>>  }
>>
>>  static int cdnsp_gen_setup(struct cdnsp_device *pdev)
>> diff --git a/drivers/usb/cdns3/cdnsp-gadget.h 
>> b/drivers/usb/cdns3/cdnsp-gadget.h
>> index 8eb1b85a08b4..6bbb26548c04 100644
>> --- a/drivers/usb/cdns3/cdnsp-gadget.h
>> +++ b/drivers/usb/cdns3/cdnsp-gadget.h
>> @@ -493,11 +493,12 @@ struct cdnsp_3xport_cap {
>>  #define CDNSP_VER_1 0x00000000
>>  #define CDNSP_VER_2 0x10000000
>>
>> -#define CDNSP_IF_EP_EXIST(pdev, ep_num, dir) ((pdev)->rev_cap.ep_supported 
>> & \
>> -                      (BIT(ep_num) << ((dir) ? 0 : 16)))
>> +#define CDNSP_IF_EP_EXIST(pdev, ep_num, dir) \
>> +                     (readl(&(pdev)->rev_cap->ep_supported) & \
>> +                     (BIT(ep_num) << ((dir) ? 0 : 16)))
>>
>>  /**
>> - * struct cdnsp_rev_cap - controller capabilities .
>> + * struct cdnsp_rev_cap - controller capabilities.
>>   * @ext_cap: Header for RTL Revision Extended Capability.
>>   * @rtl_revision: RTL revision.
>>   * @rx_buff_size: Rx buffer sizes.
>> @@ -594,7 +595,7 @@ struct cdnsp_slot_ctx {
>>  #define DEV_SPEED           GENMASK(23, 20)
>>  #define GET_DEV_SPEED(n)    (((n) & DEV_SPEED) >> 20)
>>  /* Index of the last valid endpoint context in this device context - 27:31. 
>> */
>> -#define LAST_CTX_MASK               GENMASK(31, 27)
>> +#define LAST_CTX_MASK               ((unsigned int)GENMASK(31, 27))
>>  #define LAST_CTX(p)         ((p) << 27)
>>  #define LAST_CTX_TO_EP_NUM(p)       (((p) >> 27) - 1)
>>  #define SLOT_FLAG           BIT(0)
>> @@ -1351,9 +1352,9 @@ struct cdnsp_port {
>>   * @ir_set: Current interrupter register set.
>>   * @port20_regs: Port 2.0 Peripheral Configuration Registers.
>>   * @port3x_regs: USB3.x Port Peripheral Configuration Registers.
>> + * @rev_cap: Controller Capabilities Registers.
>>   * @hcs_params1: Cached register copies of read-only HCSPARAMS1
>>   * @hcc_params: Cached register copies of read-only HCCPARAMS1
>> - * @rev_cap: Controller capability.
>>   * @setup: Temporary buffer for setup packet.
>>   * @ep0_preq: Internal allocated request used during enumeration.
>>   * @ep0_stage: ep0 stage during enumeration process.
>> @@ -1402,12 +1403,12 @@ struct cdnsp_device {
>>      struct  cdnsp_intr_reg __iomem *ir_set;
>>      struct cdnsp_20port_cap __iomem *port20_regs;
>>      struct cdnsp_3xport_cap __iomem *port3x_regs;
>> +    struct cdnsp_rev_cap __iomem *rev_cap;
>>
>>      /* Cached register copies of read-only CDNSP data */
>>      __u32 hcs_params1;
>>      __u32 hcs_params3;
>>      __u32 hcc_params;
>> -    struct cdnsp_rev_cap rev_cap;
>>      /* Lock used in interrupt thread context. */
>>      spinlock_t lock;
>>      struct usb_ctrlrequest setup;
>> diff --git a/drivers/usb/cdns3/cdnsp-mem.c b/drivers/usb/cdns3/cdnsp-mem.c
>> index 4c7d77fb097e..7a84e928710e 100644
>> --- a/drivers/usb/cdns3/cdnsp-mem.c
>> +++ b/drivers/usb/cdns3/cdnsp-mem.c
>> @@ -759,8 +759,9 @@ int cdnsp_setup_addressable_priv_dev(struct cdnsp_device 
>> *pdev)
>>
>>      port = DEV_PORT(pdev->active_port->port_num);
>>      slot_ctx->dev_port |= cpu_to_le32(port);
>> -    slot_ctx->dev_state = (pdev->device_address & DEV_ADDR_MASK);
>> -    ep0_ctx->tx_info = EP_AVG_TRB_LENGTH(0x8);
>> +    slot_ctx->dev_state = cpu_to_le32((pdev->device_address &
>> +                                       DEV_ADDR_MASK));
>> +    ep0_ctx->tx_info = cpu_to_le32(EP_AVG_TRB_LENGTH(0x8));
>>      ep0_ctx->ep_info2 = cpu_to_le32(EP_TYPE(CTRL_EP));
>>      ep0_ctx->ep_info2 |= cpu_to_le32(MAX_BURST(0) | ERROR_COUNT(3) |
>>                                       max_packets);
>> @@ -925,7 +926,7 @@ static u32 cdnsp_get_max_esit_payload(struct usb_gadget 
>> *g,
>>      /* SuperSpeedPlus Isoc ep sending over 48k per EIST. */
>>      if (g->speed >= USB_SPEED_SUPER_PLUS &&
>>          USB_SS_SSP_ISOC_COMP(pep->endpoint.desc->bmAttributes))
>> -            return le32_to_cpu(pep->endpoint.comp_desc->wBytesPerInterval);
>> +            return le16_to_cpu(pep->endpoint.comp_desc->wBytesPerInterval);
>>      /* SuperSpeed or SuperSpeedPlus Isoc ep with less than 48k per esit */
>>      else if (g->speed >= USB_SPEED_SUPER)
>>              return le16_to_cpu(pep->endpoint.comp_desc->wBytesPerInterval);
>> @@ -1184,11 +1185,11 @@ static int cdnsp_setup_port_arrays(struct 
>> cdnsp_device *pdev)
>>
>>      trace_cdnsp_init("Found USB 2.0 ports and  USB 3.0 ports.");
>>
>> -    pdev->usb2_port.regs = (struct cdnsp_port_regs *)
>> +    pdev->usb2_port.regs = (struct cdnsp_port_regs __iomem *)
>>                             (&pdev->op_regs->port_reg_base + NUM_PORT_REGS *
>>                              (pdev->usb2_port.port_num - 1));
>>
>> -    pdev->usb3_port.regs = (struct cdnsp_port_regs *)
>> +    pdev->usb3_port.regs = (struct cdnsp_port_regs __iomem *)
>>                             (&pdev->op_regs->port_reg_base + NUM_PORT_REGS *
>>                              (pdev->usb3_port.port_num - 1));
>>
>> diff --git a/drivers/usb/cdns3/cdnsp-ring.c b/drivers/usb/cdns3/cdnsp-ring.c
>> index 874d9ff5406c..e15e13ba27dc 100644
>> --- a/drivers/usb/cdns3/cdnsp-ring.c
>> +++ b/drivers/usb/cdns3/cdnsp-ring.c
>> @@ -1432,7 +1432,7 @@ static bool cdnsp_handle_event(struct cdnsp_device 
>> *pdev)
>>      unsigned int comp_code;
>>      union cdnsp_trb *event;
>>      bool update_ptrs = true;
>> -    __le32 cycle_bit;
>> +    u32 cycle_bit;
>>      int ret = 0;
>>      u32 flags;
>>
>> @@ -2198,7 +2198,7 @@ static int cdnsp_queue_isoc_tx(struct cdnsp_device 
>> *pdev,
>>       * inverted in the first TDs isoc TRB.
>>       */
>>      field = TRB_TYPE(TRB_ISOC) | TRB_TLBPC(last_burst_pkt) |
>> -            !start_cycle | TRB_SIA | TRB_TBC(burst_count);
>> +            start_cycle ? 0 : 1 | TRB_SIA | TRB_TBC(burst_count);
>>
>>      /* Fill the rest of the TRB fields, and remaining normal TRBs. */
>>      for (i = 0; i < trbs_per_td; i++) {
>> diff --git a/drivers/usb/cdns3/cdnsp-trace.h 
>> b/drivers/usb/cdns3/cdnsp-trace.h
>> index b68e282464d2..a9de1daadf07 100644
>> --- a/drivers/usb/cdns3/cdnsp-trace.h
>> +++ b/drivers/usb/cdns3/cdnsp-trace.h
>> @@ -620,7 +620,7 @@ DECLARE_EVENT_CLASS(cdnsp_log_slot_ctx,
>>      TP_fast_assign(
>>              __entry->info = le32_to_cpu(ctx->dev_info);
>>              __entry->info2 = le32_to_cpu(ctx->dev_port);
>> -            __entry->int_target = le64_to_cpu(ctx->int_target);
>> +            __entry->int_target = le32_to_cpu(ctx->int_target);
>>              __entry->state = le32_to_cpu(ctx->dev_state);
>>      ),
>>      TP_printk("%s", cdnsp_decode_slot_context(__entry->info,
>> --
>> 2.17.1
>>

--

Regards
Pawel Laszcak

Reply via email to