[PATCH 1/2] staging: fsl-dpaa2/rtc: add rtc driver

kbuild test robot lkp at intel.com
Fri Apr 20 14:12:42 UTC 2018


Hi Yangbo,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.17-rc1 next-20180420]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Yangbo-Lu/staging-fsl-dpaa2-rtc-add-rtc-driver/20180420-190320
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/staging/fsl-dpaa2/rtc/dprtc.c:43:30: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [unsigned] [usertype] dprtc_id @@    got ed int [unsigned] [usertype] dprtc_id @@
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:43:30:    expected unsigned int [unsigned] [usertype] dprtc_id
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:43:30:    got restricted __le32 [usertype] <noident>
>> drivers/staging/fsl-dpaa2/rtc/dprtc.c:155:31: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [unsigned] [usertype] object_id @@    got ed int [unsigned] [usertype] object_id @@
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:155:31:    expected unsigned int [unsigned] [usertype] object_id
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:155:31:    got restricted __le32 [usertype] <noident>
>> drivers/staging/fsl-dpaa2/rtc/dprtc.c:369:26: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [unsigned] [usertype] mask @@    got ed int [unsigned] [usertype] mask @@
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:369:26:    expected unsigned int [unsigned] [usertype] mask
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:369:26:    got restricted __le32 [usertype] <noident>
>> drivers/staging/fsl-dpaa2/rtc/dprtc.c:414:17: sparse: cast to restricted __le32
>> drivers/staging/fsl-dpaa2/rtc/dprtc.c:448:28: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [unsigned] [usertype] status @@    got ed int [unsigned] [usertype] status @@
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:448:28:    expected unsigned int [unsigned] [usertype] status
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:448:28:    got restricted __le32 [usertype] <noident>
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:491:28: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [unsigned] [usertype] status @@    got ed int [unsigned] [usertype] status @@
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:491:28:    expected unsigned int [unsigned] [usertype] status
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:491:28:    got restricted __le32 [usertype] <noident>
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:528:20: sparse: cast to restricted __le32
>> drivers/staging/fsl-dpaa2/rtc/dprtc.c:557:28: sparse: incorrect type in assignment (different base types) @@    expected unsigned long long [unsigned] [usertype] offset @@    got g long [unsigned] [usertype] offset @@
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:557:28:    expected unsigned long long [unsigned] [usertype] offset
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:557:28:    got restricted __le64 [usertype] <noident>
>> drivers/staging/fsl-dpaa2/rtc/dprtc.c:586:39: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [unsigned] [usertype] freq_compensation @@    got ed int [unsigned] [usertype] freq_compensation @@
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:586:39:    expected unsigned int [unsigned] [usertype] freq_compensation
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:586:39:    got restricted __le32 [usertype] <noident>
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:623:30: sparse: cast to restricted __le32
>> drivers/staging/fsl-dpaa2/rtc/dprtc.c:659:17: sparse: cast to restricted __le64
>> drivers/staging/fsl-dpaa2/rtc/dprtc.c:687:26: sparse: incorrect type in assignment (different base types) @@    expected unsigned long long [unsigned] [usertype] time @@    got g long [unsigned] [usertype] time @@
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:687:26:    expected unsigned long long [unsigned] [usertype] time
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:687:26:    got restricted __le64 [usertype] <noident>
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:717:26: sparse: incorrect type in assignment (different base types) @@    expected unsigned long long [unsigned] [usertype] time @@    got g long [unsigned] [usertype] time @@
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:717:26:    expected unsigned long long [unsigned] [usertype] time
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:717:26:    got restricted __le64 [usertype] <noident>
>> drivers/staging/fsl-dpaa2/rtc/dprtc.c:750:22: sparse: cast to restricted __le16
   drivers/staging/fsl-dpaa2/rtc/dprtc.c:751:22: sparse: cast to restricted __le16

vim +43 drivers/staging/fsl-dpaa2/rtc/dprtc.c

    11	
    12	/**
    13	 * dprtc_open() - Open a control session for the specified object.
    14	 * @mc_io:	Pointer to MC portal's I/O object
    15	 * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
    16	 * @dprtc_id:	DPRTC unique ID
    17	 * @token:	Returned token; use in subsequent API calls
    18	 *
    19	 * This function can be used to open a control session for an
    20	 * already created object; an object may have been declared in
    21	 * the DPL or by calling the dprtc_create function.
    22	 * This function returns a unique authentication token,
    23	 * associated with the specific object ID and the specific MC
    24	 * portal; this token must be used in all subsequent commands for
    25	 * this specific object
    26	 *
    27	 * Return:	'0' on Success; Error code otherwise.
    28	 */
    29	int dprtc_open(struct fsl_mc_io *mc_io,
    30		       u32 cmd_flags,
    31		       int dprtc_id,
    32		       u16 *token)
    33	{
    34		struct dprtc_cmd_open *cmd_params;
    35		struct fsl_mc_command cmd = { 0 };
    36		int err;
    37	
    38		/* prepare command */
    39		cmd.header = mc_encode_cmd_header(DPRTC_CMDID_OPEN,
    40						  cmd_flags,
    41						  0);
    42		cmd_params = (struct dprtc_cmd_open *)cmd.params;
  > 43		cmd_params->dprtc_id = cpu_to_le32(dprtc_id);
    44	
    45		/* send command to mc*/
    46		err = mc_send_command(mc_io, &cmd);
    47		if (err)
    48			return err;
    49	
    50		/* retrieve response parameters */
    51		*token = mc_cmd_hdr_read_token(&cmd);
    52	
    53		return err;
    54	}
    55	
    56	/**
    57	 * dprtc_close() - Close the control session of the object
    58	 * @mc_io:	Pointer to MC portal's I/O object
    59	 * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
    60	 * @token:	Token of DPRTC object
    61	 *
    62	 * After this function is called, no further operations are
    63	 * allowed on the object without opening a new control session.
    64	 *
    65	 * Return:	'0' on Success; Error code otherwise.
    66	 */
    67	int dprtc_close(struct fsl_mc_io *mc_io,
    68			u32 cmd_flags,
    69			u16 token)
    70	{
    71		struct fsl_mc_command cmd = { 0 };
    72	
    73		/* prepare command */
    74		cmd.header = mc_encode_cmd_header(DPRTC_CMDID_CLOSE, cmd_flags,
    75						  token);
    76	
    77		/* send command to mc*/
    78		return mc_send_command(mc_io, &cmd);
    79	}
    80	
    81	/**
    82	 * dprtc_create() - Create the DPRTC object.
    83	 * @mc_io:	Pointer to MC portal's I/O object
    84	 * @dprc_token:	Parent container token; '0' for default container
    85	 * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
    86	 * @cfg:	Configuration structure
    87	 * @obj_id:	Returned object id
    88	 *
    89	 * Create the DPRTC object, allocate required resources and
    90	 * perform required initialization.
    91	 *
    92	 * The function accepts an authentication token of a parent
    93	 * container that this object should be assigned to. The token
    94	 * can be '0' so the object will be assigned to the default container.
    95	 * The newly created object can be opened with the returned
    96	 * object id and using the container's associated tokens and MC portals.
    97	 *
    98	 * Return:	'0' on Success; Error code otherwise.
    99	 */
   100	int dprtc_create(struct fsl_mc_io *mc_io,
   101			 u16 dprc_token,
   102			 u32 cmd_flags,
   103			 const struct dprtc_cfg *cfg,
   104			 u32 *obj_id)
   105	{
   106		struct fsl_mc_command cmd = { 0 };
   107		int err;
   108	
   109		(void)(cfg); /* unused */
   110	
   111		/* prepare command */
   112		cmd.header = mc_encode_cmd_header(DPRTC_CMDID_CREATE,
   113						  cmd_flags,
   114						  dprc_token);
   115	
   116		/* send command to mc*/
   117		err = mc_send_command(mc_io, &cmd);
   118		if (err)
   119			return err;
   120	
   121		/* retrieve response parameters */
   122		*obj_id = mc_cmd_read_object_id(&cmd);
   123	
   124		return 0;
   125	}
   126	
   127	/**
   128	 * dprtc_destroy() - Destroy the DPRTC object and release all its resources.
   129	 * @mc_io:	Pointer to MC portal's I/O object
   130	 * @dprc_token: Parent container token; '0' for default container
   131	 * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
   132	 * @object_id:	The object id; it must be a valid id within the container that
   133	 * created this object;
   134	 *
   135	 * The function accepts the authentication token of the parent container that
   136	 * created the object (not the one that currently owns the object). The object
   137	 * is searched within parent using the provided 'object_id'.
   138	 * All tokens to the object must be closed before calling destroy.
   139	 *
   140	 * Return:	'0' on Success; error code otherwise.
   141	 */
   142	int dprtc_destroy(struct fsl_mc_io *mc_io,
   143			  u16 dprc_token,
   144			  u32 cmd_flags,
   145			  u32 object_id)
   146	{
   147		struct dprtc_cmd_destroy *cmd_params;
   148		struct fsl_mc_command cmd = { 0 };
   149	
   150		/* prepare command */
   151		cmd.header = mc_encode_cmd_header(DPRTC_CMDID_DESTROY,
   152						  cmd_flags,
   153						  dprc_token);
   154		cmd_params = (struct dprtc_cmd_destroy *)cmd.params;
 > 155		cmd_params->object_id = cpu_to_le32(object_id);
   156	
   157		/* send command to mc*/
   158		return mc_send_command(mc_io, &cmd);
   159	}
   160	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation


More information about the devel mailing list