mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: Randy Dunlap <rdunlap@infradead.org>, Tejun Heo <tj@kernel.org>,
	Lai Jiangshan <jiangshanlai@gmail.com>
Subject: [RFC PATCH] workqueue: fix cast warnings on i386
Date: Fri, 28 Apr 2023 21:45:06 -0700	[thread overview]
Message-ID: <20230429044506.24843-1-rdunlap@infradead.org> (raw)

Add casts to avoid int-to-pointer-cast warings on i386 or UML for i386:

../kernel/workqueue.c: In function ‘get_work_pwq’:
../kernel/workqueue.c:713:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  713 |                 return (void *)(data & WORK_STRUCT_WQ_DATA_MASK);
      |                        ^
../kernel/workqueue.c: In function ‘get_work_pool’:
../kernel/workqueue.c:741:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  741 |                 return ((struct pool_workqueue *)
      |                         ^
../kernel/workqueue.c: In function ‘get_work_pool_id’:
../kernel/workqueue.c:763:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  763 |                 return ((struct pool_workqueue *)
      |                         ^

Fixes: e120153ddf86 ("workqueue: fix how cpu number is stored in work->data")
Fixes: 112202d9098a ("workqueue: rename cpu_workqueue to pool_workqueue")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
---
 kernel/workqueue.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff -- a/kernel/workqueue.c b/kernel/workqueue.c
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -710,7 +710,7 @@ static struct pool_workqueue *get_work_p
 	unsigned long data = atomic_long_read(&work->data);
 
 	if (data & WORK_STRUCT_PWQ)
-		return (void *)(data & WORK_STRUCT_WQ_DATA_MASK);
+		return (void *)(unsigned long)(data & WORK_STRUCT_WQ_DATA_MASK);
 	else
 		return NULL;
 }
@@ -739,7 +739,7 @@ static struct worker_pool *get_work_pool
 
 	if (data & WORK_STRUCT_PWQ)
 		return ((struct pool_workqueue *)
-			(data & WORK_STRUCT_WQ_DATA_MASK))->pool;
+			(unsigned long)(data & WORK_STRUCT_WQ_DATA_MASK))->pool;
 
 	pool_id = data >> WORK_OFFQ_POOL_SHIFT;
 	if (pool_id == WORK_OFFQ_POOL_NONE)
@@ -761,7 +761,7 @@ static int get_work_pool_id(struct work_
 
 	if (data & WORK_STRUCT_PWQ)
 		return ((struct pool_workqueue *)
-			(data & WORK_STRUCT_WQ_DATA_MASK))->pool->id;
+			(unsigned long)(data & WORK_STRUCT_WQ_DATA_MASK))->pool->id;
 
 	return data >> WORK_OFFQ_POOL_SHIFT;
 }

             reply	other threads:[~2023-04-29  4:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-29  4:45 Randy Dunlap [this message]
2023-05-01  4:37 ` Lai Jiangshan
2023-05-01  4:42   ` Randy Dunlap
2023-05-08 13:41     ` Arnd Bergmann
2023-05-08 19:06       ` Randy Dunlap

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=20230429044506.24843-1-rdunlap@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /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

all inboxes | Powered by JetHome®