From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2JMwJ+Jif2GLVAAAWB0awg (envelope-from ) for ; Sun, 31 Oct 2021 23:45:38 -0400 Received: by simark.ca (Postfix, from userid 112) id 9E60F1F0BB; Sun, 31 Oct 2021 23:45:38 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E21891E813 for ; Sun, 31 Oct 2021 23:45:37 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8553A3857C43 for ; Mon, 1 Nov 2021 03:45:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8553A3857C43 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1635738337; bh=i424yoJpXMoWx2kdOzptS11ukUvz/GM08XdR1uBiK3M=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=D885Zquevdd1zinnpidaBks6p3PtFb1yRCq+7ztzVtU8NmooxLPVF1hlDA6wndtZa DLXdBBsYfh5R5x4VIFCzV7nQx5Y6c3P1TqiDTADMVFq3sRfs1PGQCgDZrw+QYPJURO kfxB4bRkGUrFSZFHhDUPsc+iHohl60DdghBNMxgU= Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id A5C253858C3A for ; Mon, 1 Nov 2021 03:45:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A5C253858C3A Received: by smtp.gentoo.org (Postfix, from userid 559) id 34433342D70; Mon, 1 Nov 2021 03:45:18 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH] sim: mn10300: clean up pointer casts Date: Sun, 31 Oct 2021 23:45:19 -0400 Message-Id: <20211101034519.29154-1-vapier@gentoo.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" The void *data field is used to past arbitrary data between event handlers, and these are using it to pass an enum. Fix up the casts to avoid using (long) to cast to/from pointers since there is no guarantee that's the right size. --- sim/mn10300/dv-mn103ser.c | 6 +++--- sim/mn10300/dv-mn103tim.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sim/mn10300/dv-mn103ser.c b/sim/mn10300/dv-mn103ser.c index 3465954f75f7..d2140e22c196 100644 --- a/sim/mn10300/dv-mn103ser.c +++ b/sim/mn10300/dv-mn103ser.c @@ -238,7 +238,7 @@ do_polling_event (struct hw *me, { SIM_DESC sd = hw_system (me); struct mn103ser *serial = hw_data(me); - long serial_reg = (long) data; + long serial_reg = (uintptr_t) data; char c; int count, status; @@ -280,7 +280,7 @@ do_polling_event (struct hw *me, /* Schedule next polling event */ serial->device[serial_reg].event = hw_event_queue_schedule (me, 1000, - do_polling_event, (void *)serial_reg); + do_polling_event, (void *)(uintptr_t)serial_reg); } @@ -424,7 +424,7 @@ read_status_reg (struct hw *me, serial->device[serial_reg].event = hw_event_queue_schedule (me, 1000, do_polling_event, - (void *) (long) serial_reg); + (void *)(uintptr_t)serial_reg); } if ( nr_bytes == 1 ) diff --git a/sim/mn10300/dv-mn103tim.c b/sim/mn10300/dv-mn103tim.c index ad9c24bbc6e8..76f87380d1d8 100644 --- a/sim/mn10300/dv-mn103tim.c +++ b/sim/mn10300/dv-mn103tim.c @@ -570,7 +570,7 @@ do_counter_event (struct hw *me, void *data) { struct mn103tim *timers = hw_data(me); - long timer_nr = (long) data; + long timer_nr = (uintptr_t) data; int next_timer; /* Check if counting is still enabled. */ @@ -596,7 +596,7 @@ do_counter_event (struct hw *me, /* FIX: Check if div_ratio has changed and if it's now 0. */ timers->timer[timer_nr].event = hw_event_queue_schedule (me, timers->timer[timer_nr].div_ratio, - do_counter_event, (void *)timer_nr); + do_counter_event, (void *)(uintptr_t)timer_nr); } else { @@ -611,7 +611,7 @@ do_counter6_event (struct hw *me, void *data) { struct mn103tim *timers = hw_data(me); - long timer_nr = (long) data; + long timer_nr = (uintptr_t) data; int next_timer; /* Check if counting is still enabled. */ @@ -625,7 +625,7 @@ do_counter6_event (struct hw *me, /* FIX: Check if div_ratio has changed and if it's now 0. */ timers->timer[timer_nr].event = hw_event_queue_schedule (me, timers->timer[timer_nr].div_ratio, - do_counter6_event, (void *)timer_nr); + do_counter6_event, (void *)(uintptr_t)timer_nr); } else { @@ -808,7 +808,7 @@ write_mode_reg (struct hw *me, timers->timer[timer_nr].event = hw_event_queue_schedule(me, div_ratio, do_counter_event, - (void *)(timer_nr)); + (void *)(uintptr_t)timer_nr); } } } @@ -908,7 +908,7 @@ write_tm6md (struct hw *me, timers->timer[timer_nr].event = hw_event_queue_schedule(me, div_ratio, do_counter6_event, - (void *)(timer_nr)); + (void *)(uintptr_t)timer_nr); } } else -- 2.33.0