From: Greg KH <gregkh@linuxfoundation.org>
To: Tony Cho <tony.cho@atmel.com>
Cc: devel@driverdev.osuosl.org, rachel.kim@atmel.com,
chris.park@atmel.com, austin.shin@atmel.com,
linux-wireless@vger.kernel.org, johnny.kim@atmel.com,
Nicolas.FERRE@atmel.com, robin.hwang@atmel.com,
jude.lee@atmel.com, leo.kim@atmel.com
Subject: Re: [PATCH 25/28] staging: wilc1000: change cast type from pointer to uintptr_t
Date: Fri, 31 Jul 2015 13:50:19 -0700 [thread overview]
Message-ID: <20150731205019.GC1650@kroah.com> (raw)
In-Reply-To: <1438328316-30197-26-git-send-email-tony.cho@atmel.com>
On Fri, Jul 31, 2015 at 04:38:33PM +0900, Tony Cho wrote:
> From: glen lee <glen.lee@atmel.com>
>
> To use drvHandler as integer operation, cast type to uintptr_t.
>
> Here is the build warning.
> drivers/staging/wilc1000/wilc_wlan.c:1871:23: warning: cast from pointer to
> integer of different size [-Wpointer-to-int-cast]
> int driver_handler = (u32)drvHandler;
>
> Signed-off-by: glen lee <glen.lee@atmel.com>
> Signed-off-by: Tony Cho <tony.cho@atmel.com>
> ---
> drivers/staging/wilc1000/linux_wlan.c | 2 +-
> drivers/staging/wilc1000/wilc_wlan.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
> index ec80849..14c2071 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -1056,7 +1056,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n
> goto _fail_;
> }
>
> - *(int *)c_val = (u32)pstrWFIDrv;
> + *(int *)c_val = (uintptr_t)pstrWFIDrv;
Why is the cast needed at all?
>
> if (!g_linux_wlan->oup.wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
> goto _fail_;
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
> index f5075b26..2cc23d5 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -1868,7 +1868,7 @@ static int wilc_wlan_cfg_commit(int type, WILC_WFIDrvHandle drvHandler)
> wilc_cfg_frame_t *cfg = &p->cfg_frame;
> int total_len = p->cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE;
> int seq_no = p->cfg_seq_no % 256;
> - int driver_handler = (u32)drvHandler;
> + int driver_handler = (uintptr_t)drvHandler;
You can't cast a pointer to an integer, it does not work on all systems,
which is what the compiler warnings is telling you.
If this really is a pointer, use a pointer, otherwise, use an integer,
but don't cast between the two.
thanks,
greg k-h
next prev parent reply other threads:[~2015-07-31 20:50 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-31 7:38 [PATCH 00/28] removing the compile warnings for 64-bit Tony Cho
2015-07-31 7:38 ` [PATCH 01/28] staging: wilc1000: change type of driver handler in host interface msg Tony Cho
2015-07-31 20:46 ` Greg KH
2015-07-31 7:38 ` [PATCH 02/28] staging: wilc1000: change void type of argument with WILC_WFIDrvHandle Tony Cho
2015-07-31 20:46 ` Greg KH
2015-07-31 7:38 ` [PATCH 03/28] staging: wilc1000: move structure WILC_WFIDrvHandle into wilc_wlan_if.h Tony Cho
2015-07-31 7:38 ` [PATCH 04/28] staging: wilc1000: change type of argument 5 in SendConfigPkt Tony Cho
2015-07-31 7:38 ` [PATCH 05/28] staging: wilc1000: remove unnecessary type cast Tony Cho
2015-07-31 7:38 ` [PATCH 06/28] staging: wilc1000: chage driver handler variable in SendConfigPkt Tony Cho
2015-07-31 7:38 ` [PATCH 07/28] staging: wilc1000: remove unused variables Tony Cho
2015-07-31 7:38 ` [PATCH 08/28] staging: wilc1000: change drvHandler type in wlan_cfg_get Tony Cho
2015-07-31 7:38 ` [PATCH 09/28] staging: wilc1000: change drvHandler type in wlan_cfg_set Tony Cho
2015-07-31 7:38 ` [PATCH 10/28] staging: wilc1000: change driver handle variable Tony Cho
2015-07-31 7:38 ` [PATCH 11/28] staging: wilc1000: fix incompatible type in assignment warning Tony Cho
2015-07-31 7:38 ` [PATCH 12/28] staging: wilc1000: change type of driver handler in tstrInterfaceInfo Tony Cho
2015-07-31 7:38 ` [PATCH 13/28] staging: wilc1000: change type of argument in host_int_set_wfi_drv_handler Tony Cho
2015-07-31 7:38 ` [PATCH 14/28] staging: wilc1000: remove unnecessary type cast " Tony Cho
2015-07-31 7:38 ` [PATCH 15/28] staging: wilc1000: fix cast from pointer to integer warning Tony Cho
2015-07-31 7:38 ` [PATCH 16/28] staging: wilc1000: change type of variable Tony Cho
2015-07-31 7:38 ` [PATCH 17/28] staging: wilc1000: fix comparison between different type warning Tony Cho
2015-07-31 7:38 ` [PATCH 18/28] staging: wilc1000: change pstrWFIDrv with drvHandler Tony Cho
2015-07-31 7:38 ` [PATCH 19/28] staging: wilc1000: change type of variable in tstrHostIfSetDrvHandler Tony Cho
2015-07-31 7:38 ` [PATCH 20/28] staging: wilc1000: remove unnecessary type case Tony Cho
2015-07-31 7:38 ` [PATCH 21/28] staging: wilc1000: remove unwanted type cast Tony Cho
2015-07-31 7:38 ` [PATCH 22/28] staging: wilc1000: fix passing argument from incompatible type warning Tony Cho
2015-07-31 7:38 ` [PATCH 23/28] staging: wilc1000: change type of parameter in wilc_wlan_cfg_commit Tony Cho
2015-07-31 7:38 ` [PATCH 24/28] staging: wilc1000: fix cast from pointer to integer warning Tony Cho
2015-07-31 20:51 ` Greg KH
2015-07-31 7:38 ` [PATCH 25/28] staging: wilc1000: change cast type from pointer to uintptr_t Tony Cho
2015-07-31 20:50 ` Greg KH [this message]
2015-07-31 7:38 ` [PATCH 26/28] staging: wilc1000: remove unused variable Tony Cho
2015-07-31 7:38 ` [PATCH 27/28] staging: wilc1000: fix casting build warning Tony Cho
2015-07-31 7:38 ` [PATCH 28/28] staging: wilc1000: change data type of variable Tony Cho
2015-07-31 20:48 ` Greg KH
2015-07-31 12:49 ` [PATCH 00/28] removing the compile warnings for 64-bit Sudip Mukherjee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150731205019.GC1650@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Nicolas.FERRE@atmel.com \
--cc=austin.shin@atmel.com \
--cc=chris.park@atmel.com \
--cc=devel@driverdev.osuosl.org \
--cc=johnny.kim@atmel.com \
--cc=jude.lee@atmel.com \
--cc=leo.kim@atmel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=rachel.kim@atmel.com \
--cc=robin.hwang@atmel.com \
--cc=tony.cho@atmel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).