Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: sh-msiof: Make words/fs unsigned in FIFO helpers

Make the words and fs parameters of the various FIFO filler and
emptier functions unsigned, as they can never be negative.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/a7b13ecb1811148227ec8c883079085ed1ea6eac.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Geert Uytterhoeven and committed by
Mark Brown
74cb19c9 b4eec5cd

+51 -33
+51 -33
drivers/spi/spi-sh-msiof.c
··· 412 412 } 413 413 414 414 static void sh_msiof_spi_write_fifo_8(struct sh_msiof_spi_priv *p, 415 - const void *tx_buf, int words, int fs) 415 + const void *tx_buf, unsigned int words, 416 + unsigned int fs) 416 417 { 417 418 const u8 *buf_8 = tx_buf; 418 - int k; 419 + unsigned int k; 419 420 420 421 for (k = 0; k < words; k++) 421 422 sh_msiof_write(p, SITFDR, buf_8[k] << fs); 422 423 } 423 424 424 425 static void sh_msiof_spi_write_fifo_16(struct sh_msiof_spi_priv *p, 425 - const void *tx_buf, int words, int fs) 426 + const void *tx_buf, unsigned int words, 427 + unsigned int fs) 426 428 { 427 429 const u16 *buf_16 = tx_buf; 428 - int k; 430 + unsigned int k; 429 431 430 432 for (k = 0; k < words; k++) 431 433 sh_msiof_write(p, SITFDR, buf_16[k] << fs); 432 434 } 433 435 434 436 static void sh_msiof_spi_write_fifo_16u(struct sh_msiof_spi_priv *p, 435 - const void *tx_buf, int words, int fs) 437 + const void *tx_buf, unsigned int words, 438 + unsigned int fs) 436 439 { 437 440 const u16 *buf_16 = tx_buf; 438 - int k; 441 + unsigned int k; 439 442 440 443 for (k = 0; k < words; k++) 441 444 sh_msiof_write(p, SITFDR, get_unaligned(&buf_16[k]) << fs); 442 445 } 443 446 444 447 static void sh_msiof_spi_write_fifo_32(struct sh_msiof_spi_priv *p, 445 - const void *tx_buf, int words, int fs) 448 + const void *tx_buf, unsigned int words, 449 + unsigned int fs) 446 450 { 447 451 const u32 *buf_32 = tx_buf; 448 - int k; 452 + unsigned int k; 449 453 450 454 for (k = 0; k < words; k++) 451 455 sh_msiof_write(p, SITFDR, buf_32[k] << fs); 452 456 } 453 457 454 458 static void sh_msiof_spi_write_fifo_32u(struct sh_msiof_spi_priv *p, 455 - const void *tx_buf, int words, int fs) 459 + const void *tx_buf, unsigned int words, 460 + unsigned int fs) 456 461 { 457 462 const u32 *buf_32 = tx_buf; 458 - int k; 463 + unsigned int k; 459 464 460 465 for (k = 0; k < words; k++) 461 466 sh_msiof_write(p, SITFDR, get_unaligned(&buf_32[k]) << fs); 462 467 } 463 468 464 469 static void sh_msiof_spi_write_fifo_s32(struct sh_msiof_spi_priv *p, 465 - const void *tx_buf, int words, int fs) 470 + const void *tx_buf, unsigned int words, 471 + unsigned int fs) 466 472 { 467 473 const u32 *buf_32 = tx_buf; 468 - int k; 474 + unsigned int k; 469 475 470 476 for (k = 0; k < words; k++) 471 477 sh_msiof_write(p, SITFDR, swab32(buf_32[k] << fs)); 472 478 } 473 479 474 480 static void sh_msiof_spi_write_fifo_s32u(struct sh_msiof_spi_priv *p, 475 - const void *tx_buf, int words, int fs) 481 + const void *tx_buf, 482 + unsigned int words, unsigned int fs) 476 483 { 477 484 const u32 *buf_32 = tx_buf; 478 - int k; 485 + unsigned int k; 479 486 480 487 for (k = 0; k < words; k++) 481 488 sh_msiof_write(p, SITFDR, swab32(get_unaligned(&buf_32[k]) << fs)); 482 489 } 483 490 484 491 static void sh_msiof_spi_read_fifo_8(struct sh_msiof_spi_priv *p, 485 - void *rx_buf, int words, int fs) 492 + void *rx_buf, unsigned int words, 493 + unsigned int fs) 486 494 { 487 495 u8 *buf_8 = rx_buf; 488 - int k; 496 + unsigned int k; 489 497 490 498 for (k = 0; k < words; k++) 491 499 buf_8[k] = sh_msiof_read(p, SIRFDR) >> fs; 492 500 } 493 501 494 502 static void sh_msiof_spi_read_fifo_16(struct sh_msiof_spi_priv *p, 495 - void *rx_buf, int words, int fs) 503 + void *rx_buf, unsigned int words, 504 + unsigned int fs) 496 505 { 497 506 u16 *buf_16 = rx_buf; 498 - int k; 507 + unsigned int k; 499 508 500 509 for (k = 0; k < words; k++) 501 510 buf_16[k] = sh_msiof_read(p, SIRFDR) >> fs; 502 511 } 503 512 504 513 static void sh_msiof_spi_read_fifo_16u(struct sh_msiof_spi_priv *p, 505 - void *rx_buf, int words, int fs) 514 + void *rx_buf, unsigned int words, 515 + unsigned int fs) 506 516 { 507 517 u16 *buf_16 = rx_buf; 508 - int k; 518 + unsigned int k; 509 519 510 520 for (k = 0; k < words; k++) 511 521 put_unaligned(sh_msiof_read(p, SIRFDR) >> fs, &buf_16[k]); 512 522 } 513 523 514 524 static void sh_msiof_spi_read_fifo_32(struct sh_msiof_spi_priv *p, 515 - void *rx_buf, int words, int fs) 525 + void *rx_buf, unsigned int words, 526 + unsigned int fs) 516 527 { 517 528 u32 *buf_32 = rx_buf; 518 - int k; 529 + unsigned int k; 519 530 520 531 for (k = 0; k < words; k++) 521 532 buf_32[k] = sh_msiof_read(p, SIRFDR) >> fs; 522 533 } 523 534 524 535 static void sh_msiof_spi_read_fifo_32u(struct sh_msiof_spi_priv *p, 525 - void *rx_buf, int words, int fs) 536 + void *rx_buf, unsigned int words, 537 + unsigned int fs) 526 538 { 527 539 u32 *buf_32 = rx_buf; 528 - int k; 540 + unsigned int k; 529 541 530 542 for (k = 0; k < words; k++) 531 543 put_unaligned(sh_msiof_read(p, SIRFDR) >> fs, &buf_32[k]); 532 544 } 533 545 534 546 static void sh_msiof_spi_read_fifo_s32(struct sh_msiof_spi_priv *p, 535 - void *rx_buf, int words, int fs) 547 + void *rx_buf, unsigned int words, 548 + unsigned int fs) 536 549 { 537 550 u32 *buf_32 = rx_buf; 538 - int k; 551 + unsigned int k; 539 552 540 553 for (k = 0; k < words; k++) 541 554 buf_32[k] = swab32(sh_msiof_read(p, SIRFDR) >> fs); 542 555 } 543 556 544 557 static void sh_msiof_spi_read_fifo_s32u(struct sh_msiof_spi_priv *p, 545 - void *rx_buf, int words, int fs) 558 + void *rx_buf, unsigned int words, 559 + unsigned int fs) 546 560 { 547 561 u32 *buf_32 = rx_buf; 548 - int k; 562 + unsigned int k; 549 563 550 564 for (k = 0; k < words; k++) 551 565 put_unaligned(swab32(sh_msiof_read(p, SIRFDR) >> fs), &buf_32[k]); ··· 687 673 688 674 static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p, 689 675 void (*tx_fifo)(struct sh_msiof_spi_priv *, 690 - const void *, int, int), 676 + const void *, unsigned int, 677 + unsigned int), 691 678 void (*rx_fifo)(struct sh_msiof_spi_priv *, 692 - void *, int, int), 679 + void *, unsigned int, 680 + unsigned int), 693 681 const void *tx_buf, void *rx_buf, 694 682 unsigned int words, unsigned int bits) 695 683 { 696 - int fifo_shift; 684 + unsigned int fifo_shift; 697 685 int ret; 698 686 699 687 /* limit maximum word transfer to rx/tx fifo size */ ··· 929 913 { 930 914 struct sh_msiof_spi_priv *p = spi_controller_get_devdata(ctlr); 931 915 void (*copy32)(u32 *, const u32 *, unsigned int); 932 - void (*tx_fifo)(struct sh_msiof_spi_priv *, const void *, int, int); 933 - void (*rx_fifo)(struct sh_msiof_spi_priv *, void *, int, int); 916 + void (*tx_fifo)(struct sh_msiof_spi_priv *, const void *, unsigned int, 917 + unsigned int); 918 + void (*rx_fifo)(struct sh_msiof_spi_priv *, void *, unsigned int, 919 + unsigned int); 934 920 const void *tx_buf = t->tx_buf; 935 921 void *rx_buf = t->rx_buf; 936 922 unsigned int len = t->len;