Skip to content

Commit 38fdde3

Browse files
committed
KNF
Remove some unnecessary casts and parenthesis
1 parent 591b35f commit 38fdde3

File tree

1 file changed

+29
-24
lines changed

1 file changed

+29
-24
lines changed

sys/arch/hppa/dev/summitfb.c

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: summitfb.c,v 1.21 2024/12/26 17:41:27 riastradh Exp $ */
1+
/* $NetBSD: summitfb.c,v 1.22 2024/12/27 13:46:12 skrll Exp $ */
22

33
/* $OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $ */
44

@@ -27,7 +27,7 @@
2727
*/
2828

2929
#include <sys/cdefs.h>
30-
__KERNEL_RCSID(0, "$NetBSD: summitfb.c,v 1.21 2024/12/26 17:41:27 riastradh Exp $");
30+
__KERNEL_RCSID(0, "$NetBSD: summitfb.c,v 1.22 2024/12/27 13:46:12 skrll Exp $");
3131

3232
#include <sys/param.h>
3333
#include <sys/systm.h>
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: summitfb.c,v 1.21 2024/12/26 17:41:27 riastradh Exp
5454

5555
#include "opt_summitfb.h"
5656

57+
#define SUMMITFB_DEBUG
5758
#ifdef SUMMITFB_DEBUG
5859
#define DPRINTF(s) printf s
5960
#else
@@ -260,11 +261,11 @@ summitfb_attach(device_t parent, device_t self, void *aux)
260261

261262
sc->sc_scr.scr_rom = sc->sc_base.sc_rom;
262263
ret = sti_screen_setup(&sc->sc_scr, STI_FBMODE);
263-
{
264-
struct sti_dd *dd = &rom->rom_dd;
265-
sti_fetchfonts(&sc->sc_scr, NULL, dd->dd_fntaddr, 0);
266-
summitfb_copyfont(sc);
267-
}
264+
265+
struct sti_dd *dd = &rom->rom_dd;
266+
sti_fetchfonts(&sc->sc_scr, NULL, dd->dd_fntaddr, 0);
267+
summitfb_copyfont(sc);
268+
268269
sc->sc_width = sc->sc_scr.scr_cfg.scr_width;
269270
sc->sc_height = sc->sc_scr.scr_cfg.scr_height;
270271
sc->sc_write_mode = 0xffffffff;
@@ -399,10 +400,10 @@ summitfb_check_rom(struct summitfb_softc *spc, struct pci_attach_args *pa)
399400
}
400401

401402
summitfb_disable_rom_internal(spc);
403+
402404
/*
403405
* Iterate over the ROM images, pick the best candidate.
404406
*/
405-
406407
selected = (bus_addr_t)-1;
407408
for (offs = 0; offs < romsize; offs += subsize) {
408409
summitfb_enable_rom_internal(spc);
@@ -454,7 +455,7 @@ summitfb_check_rom(struct summitfb_softc *spc, struct pci_attach_args *pa)
454455
* code is for.
455456
*/
456457

457-
suboffs = offs +(bus_addr_t)bus_space_read_2(pa->pa_memt, romh,
458+
suboffs = offs + bus_space_read_2(pa->pa_memt, romh,
458459
offs + 0x18);
459460
tmp = bus_space_read_4(pa->pa_memt, romh, suboffs + 0);
460461
tmp = le32toh(tmp);
@@ -509,8 +510,7 @@ summitfb_check_rom(struct summitfb_softc *spc, struct pci_attach_args *pa)
509510
*/
510511

511512
summitfb_enable_rom_internal(spc);
512-
offs = selected +
513-
(bus_addr_t)bus_space_read_2(pa->pa_memt, romh, selected + 0x0e);
513+
offs = selected + bus_space_read_2(pa->pa_memt, romh, selected + 0x0e);
514514
for (i = 0; i < STI_REGION_MAX; i++) {
515515
rc = summitfb_readbar(sc, pa, i,
516516
bus_space_read_1(pa->pa_memt, romh, offs + i));
@@ -523,9 +523,8 @@ summitfb_check_rom(struct summitfb_softc *spc, struct pci_attach_args *pa)
523523
*/
524524

525525
offs = selected +
526-
(bus_addr_t)bus_space_read_4(pa->pa_memt, romh, selected + 0x08);
527-
stiromsize = (bus_addr_t)bus_space_read_4(pa->pa_memt, romh,
528-
offs + 0x18);
526+
bus_space_read_4(pa->pa_memt, romh, selected + 0x08);
527+
stiromsize = bus_space_read_4(pa->pa_memt, romh, offs + 0x18);
529528
stiromsize = le32toh(stiromsize);
530529
summitfb_disable_rom_internal(spc);
531530

@@ -664,7 +663,8 @@ summitfb_wait(struct summitfb_softc *sc)
664663
static inline void
665664
summitfb_write_mode(struct summitfb_softc *sc, uint32_t mode)
666665
{
667-
if (sc->sc_write_mode == mode) return;
666+
if (sc->sc_write_mode == mode)
667+
return;
668668
summitfb_wait(sc);
669669
summitfb_write4(sc, VISFX_VRAM_WRITE_MODE, mode);
670670
summitfb_write4(sc, VISFX_VRAM_READ_MODE,mode & 0x07fff000);
@@ -1359,7 +1359,7 @@ summitfb_copycols(void *cookie, int row, int srccol, int dstcol, int ncols)
13591359
struct summitfb_softc *sc = scr->scr_cookie;
13601360
int32_t xs, xd, y, width, height;
13611361

1362-
if ((sc->sc_locked == 0) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {
1362+
if (sc->sc_locked == 0 && sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
13631363

13641364
if (ri->ri_crow == row &&
13651365
ri->ri_ccol >= srccol && ri->ri_ccol < (srccol + ncols) &&
@@ -1389,7 +1389,7 @@ summitfb_erasecols(void *cookie, int row, int startcol, int ncols,
13891389
struct summitfb_softc *sc = scr->scr_cookie;
13901390
int32_t x, y, width, height, fg, bg, ul;
13911391

1392-
if ((sc->sc_locked == 0) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {
1392+
if (sc->sc_locked == 0 && sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
13931393
x = ri->ri_xorigin + ri->ri_font->fontwidth * startcol;
13941394
y = ri->ri_yorigin + ri->ri_font->fontheight * row;
13951395
width = ri->ri_font->fontwidth * ncols;
@@ -1413,7 +1413,7 @@ summitfb_copyrows(void *cookie, int srcrow, int dstrow, int nrows)
14131413
struct summitfb_softc *sc = scr->scr_cookie;
14141414
int32_t x, ys, yd, width, height;
14151415

1416-
if ((sc->sc_locked == 0) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {
1416+
if (sc->sc_locked == 0 && sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
14171417

14181418
if (ri->ri_crow >= srcrow && ri->ri_crow < (srcrow + nrows) &&
14191419
(ri->ri_flg & RI_CURSOR)) {
@@ -1440,7 +1440,7 @@ summitfb_eraserows(void *cookie, int row, int nrows, long fillattr)
14401440
struct summitfb_softc *sc = scr->scr_cookie;
14411441
int32_t x, y, width, height, fg, bg, ul;
14421442

1443-
if ((sc->sc_locked == 0) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {
1443+
if (sc->sc_locked == 0 && sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
14441444
x = ri->ri_xorigin;
14451445
y = ri->ri_yorigin + ri->ri_font->fontheight * row;
14461446
width = ri->ri_emuwidth;
@@ -1464,10 +1464,13 @@ summitfb_move_cursor(struct summitfb_softc *sc, int x, int y)
14641464
sc->sc_cursor_y = y;
14651465
y -= sc->sc_hot_y;
14661466

1467-
if (x < 0) x = 0x1000 - x;
1468-
if (y < 0) y = 0x1000 - y;
1467+
if (x < 0)
1468+
x = 0x1000 - x;
1469+
if (y < 0)
1470+
y = 0x1000 - y;
14691471
pos = (x << 16) | y;
1470-
if (sc->sc_enabled) pos |= 0x80000000;
1472+
if (sc->sc_enabled)
1473+
pos |= 0x80000000;
14711474
summitfb_write4(sc, VISFX_CURSOR_POS, pos);
14721475
}
14731476

@@ -1618,11 +1621,13 @@ summitfb_copyfont(struct summitfb_softc *sc)
16181621
struct wsdisplay_font *f;
16191622
int bufsize, i, si;
16201623

1621-
if (font == NULL) return;
1624+
if (font == NULL)
1625+
return;
16221626
bufsize = sizeof(struct wsdisplay_font) + 32 + fp->bpc * ( fp->last - fp->first);
16231627
DPRINTF(("%s: %dx%d %d\n", __func__, fp->width, fp->height, bufsize));
16241628
fontbuf = kmem_alloc(bufsize, KM_NOSLEEP);
1625-
if (fontbuf == NULL) return;
1629+
if (fontbuf == NULL)
1630+
return;
16261631
f = (struct wsdisplay_font *)fontbuf;
16271632
f->name = fontbuf + sizeof(struct wsdisplay_font);
16281633
fontdata = fontbuf + sizeof(struct wsdisplay_font) + 32;

0 commit comments

Comments
 (0)