svn commit: r358029 - projects/clang1000-import/sys/dev/altera/sdcard
Dimitry Andric
dim at FreeBSD.org
Mon Feb 17 18:31:33 UTC 2020
Author: dim
Date: Mon Feb 17 18:31:32 2020
New Revision: 358029
URL: https://svnweb.freebsd.org/changeset/base/358029
Log:
Tentatively apply D23730:
Fix compile errors in altera_sdcard_io.c after r357647
Summary:
After rS357647, building universe results in compilation errors for
_.mips.BERI_DE4_SDROOT:
```
sys/dev/altera/sdcard/altera_sdcard_io.c: In function 'altera_sdcard_io_start_internal':
sys/dev/altera/sdcard/altera_sdcard_io.c:299:13: error: '*bp' is a pointer; did you mean to use '->'?
switch (*bp->bio_cmd) {
^~
->
sys/dev/altera/sdcard/altera_sdcard_io.c:301:38: error: '*bp' is a pointer; did you mean to use '->'?
altera_sdcard_write_cmd_arg(sc, *bp->bio_pblkno *
^~
->
sys/dev/altera/sdcard/altera_sdcard_io.c:307:42: error: '*bp' is a pointer; did you mean to use '->'?
altera_sdcard_write_rxtx_buffer(sc, *bp->bio_data,
^~
->
sys/dev/altera/sdcard/altera_sdcard_io.c:308:10: error: '*bp' is a pointer; did you mean to use '->'?
*bp->bio_bcount);
^~
->
sys/dev/altera/sdcard/altera_sdcard_io.c:309:38: error: '*bp' is a pointer; did you mean to use '->'?
altera_sdcard_write_cmd_arg(sc, *bp->bio_pblkno *
^~
->
sys/dev/altera/sdcard/altera_sdcard_io.c: In function 'altera_sdcard_io_start':
sys/dev/altera/sdcard/altera_sdcard_io.c:336:20: error: incompatible types when assigning to type 'struct bio *' from type 'struct bio'
sc->as_currentbio = *bp;
^
```
The first few are because `->` has a higher precedence than `*`, so the
expressions should use `(*bp)->foo` instead. I also renamed the
variable to `bpp` to make it clearer that it is a pointer-to-pointer.
The last one is because `sc->as_currentbio` is already a `struct bio *`,
there is no need to dereference `bp` there.
Last but not least, I would really suggest rewriting the
`altera_sdcard_io_start_internal()` function to just return success or
failure, so the caller can decide to set `bp` to NULL.
Modified:
projects/clang1000-import/sys/dev/altera/sdcard/altera_sdcard_io.c
Modified: projects/clang1000-import/sys/dev/altera/sdcard/altera_sdcard_io.c
==============================================================================
--- projects/clang1000-import/sys/dev/altera/sdcard/altera_sdcard_io.c Mon Feb 17 18:05:03 2020 (r358028)
+++ projects/clang1000-import/sys/dev/altera/sdcard/altera_sdcard_io.c Mon Feb 17 18:31:32 2020 (r358029)
@@ -293,27 +293,27 @@ recheck:
}
static void
-altera_sdcard_io_start_internal(struct altera_sdcard_softc *sc, struct bio **bp)
+altera_sdcard_io_start_internal(struct altera_sdcard_softc *sc, struct bio **bpp)
{
- switch (*bp->bio_cmd) {
+ switch ((*bpp)->bio_cmd) {
case BIO_READ:
- altera_sdcard_write_cmd_arg(sc, *bp->bio_pblkno *
+ altera_sdcard_write_cmd_arg(sc, (*bpp)->bio_pblkno *
ALTERA_SDCARD_SECTORSIZE);
altera_sdcard_write_cmd(sc, ALTERA_SDCARD_CMD_READ_BLOCK);
break;
case BIO_WRITE:
- altera_sdcard_write_rxtx_buffer(sc, *bp->bio_data,
- *bp->bio_bcount);
- altera_sdcard_write_cmd_arg(sc, *bp->bio_pblkno *
+ altera_sdcard_write_rxtx_buffer(sc, (*bpp)->bio_data,
+ (*bpp)->bio_bcount);
+ altera_sdcard_write_cmd_arg(sc, (*bpp)->bio_pblkno *
ALTERA_SDCARD_SECTORSIZE);
altera_sdcard_write_cmd(sc, ALTERA_SDCARD_CMD_WRITE_BLOCK);
break;
default:
- biofinish(*bp, NULL, EOPNOTSUPP);
- *bp = NULL;
+ biofinish(*bpp, NULL, EOPNOTSUPP);
+ *bpp = NULL;
}
}
@@ -333,7 +333,7 @@ altera_sdcard_io_start(struct altera_sdcard_softc *sc,
KASSERT(bp->bio_bcount == ALTERA_SDCARD_SECTORSIZE,
("%s: I/O size not %d", __func__, ALTERA_SDCARD_SECTORSIZE));
altera_sdcard_io_start_internal(sc, &bp);
- sc->as_currentbio = *bp;
+ sc->as_currentbio = bp;
sc->as_retriesleft = ALTERA_SDCARD_RETRY_LIMIT;
}
More information about the svn-src-projects
mailing list