From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 12/12] imx-usb-loader: drop some unnecessary casting
Date: Thu, 14 Jul 2022 09:27:22 +0200 [thread overview]
Message-ID: <20220714072722.2863571-13-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20220714072722.2863571-1-s.hauer@pengutronix.de>
Change the buffer pointer in transfer() to type void * to drop some
unnecessary type casting from the callers.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
scripts/imx/imx-usb-loader.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index f3dcc61b9e..450ee14354 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -456,7 +456,7 @@ static void dump_bytes(const void *src, unsigned cnt, unsigned addr)
* EP2IN - bulk in
* (max packet size of 512 bytes)
*/
-static int transfer(int report, unsigned char *p, unsigned cnt, int *last_trans)
+static int transfer(int report, void *p, unsigned cnt, int *last_trans)
{
int err;
if (cnt > mach_id->max_transfer)
@@ -527,7 +527,7 @@ static int do_status(void)
unsigned char tmp[64];
int retry = 0;
int err;
- static const struct sdp_command status_command = {
+ static struct sdp_command status_command = {
.cmd = SDP_ERROR_STATUS,
.addr = 0,
.format = 0,
@@ -537,8 +537,7 @@ static int do_status(void)
};
for (;;) {
- err = transfer(1, (unsigned char *) &status_command, 16,
- &last_trans);
+ err = transfer(1, &status_command, 16, &last_trans);
if (verbose > 2)
printf("report 1, wrote %i bytes, err=%i\n", last_trans, err);
@@ -591,8 +590,7 @@ static int read_memory(unsigned addr, void *dest, unsigned cnt)
read_reg_command.cnt = htonl(cnt);
for (;;) {
- err = transfer(1, (unsigned char *) &read_reg_command, 16,
- &last_trans);
+ err = transfer(1, &read_reg_command, 16, &last_trans);
if (!err)
break;
printf("read_reg_command err=%i, last_trans=%i\n", err, last_trans);
@@ -668,8 +666,7 @@ static int write_memory(unsigned addr, unsigned val, int width)
write_reg_command.data = htonl(val);
for (;;) {
- err = transfer(1, (unsigned char *) &write_reg_command, 16,
- &last_trans);
+ err = transfer(1, &write_reg_command, 16, &last_trans);
if (!err)
break;
printf("write_reg_command err=%i, last_trans=%i\n", err, last_trans);
@@ -771,8 +768,7 @@ static int load_file(void *buf, unsigned len, unsigned dladdr,
dl_command.rsvd = type;
for (;;) {
- err = transfer(1, (unsigned char *) &dl_command, 16,
- &last_trans);
+ err = transfer(1, &dl_command, 16, &last_trans);
if (!err)
break;
@@ -832,8 +828,7 @@ static int sdp_jump_address(unsigned addr)
jump_command.addr = htonl(addr);
for (;;) {
- err = transfer(1, (unsigned char *) &jump_command, 16,
- &last_trans);
+ err = transfer(1, &jump_command, 16, &last_trans);
if (!err)
break;
@@ -1479,7 +1474,7 @@ static int mxs_load_buf(uint8_t *data, int size)
dl_command.cmd = MXS_CMD_FW_DOWNLOAD;
dl_command.dw_size = htonl(size);
- err = transfer(1, (unsigned char *) &dl_command, 20, &last_trans);
+ err = transfer(1, &dl_command, 20, &last_trans);
if (err) {
printf("transfer error at init step: err=%i, last_trans=%i\n",
err, last_trans);
--
2.30.2
prev parent reply other threads:[~2022-07-14 7:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 7:27 [PATCH 00/12] imx-usb-loader support for i.MX8MP Sascha Hauer
2022-07-14 7:27 ` [PATCH 01/12] ARM: i.MX8MM: Prepare loading only piggydata in imx-usb-loader Sascha Hauer
2022-07-14 7:27 ` [PATCH 02/12] ARM: i.MX8M: Add romapi support Sascha Hauer
2022-07-14 7:27 ` [PATCH 03/12] ARM: i.MX8MP: Add common code to load image and jump to it via TF-A Sascha Hauer
2022-07-14 7:27 ` [PATCH 04/12] ARM: i.MX8MP-EVK: Use imx8mp_load_and_start_image_via_tfa() Sascha Hauer
2022-07-14 7:27 ` [PATCH 05/12] imx-usb-loader: Factor out common code to function Sascha Hauer
2022-07-14 7:27 ` [PATCH 06/12] imx-usb-loader: rename mxs functions Sascha Hauer
2022-07-14 7:27 ` [PATCH 07/12] imx-usb-loader: Add i.MX8MP support Sascha Hauer
2022-07-29 9:33 ` Marco Felsch
2022-08-08 12:20 ` Sascha Hauer
2022-07-14 7:27 ` [PATCH 08/12] imx-usb-loader: drop some casting Sascha Hauer
2022-07-14 7:27 ` [PATCH 09/12] imx-usb-loader: Fix first stage length Sascha Hauer
2022-07-14 7:27 ` [PATCH 10/12] imx-usb-loader: simplify read_memory() Sascha Hauer
2022-07-14 7:27 ` [PATCH 11/12] imx-usb-loader: verify correct image length Sascha Hauer
2022-07-14 7:27 ` Sascha Hauer [this message]
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=20220714072722.2863571-13-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.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