Compare
40bb03d3ea6f6a915218508819ecc4d7a7fa260d..4eac392e48fc0ddc6d5ac10d57aac7245c17d0d9
spi: spi-fsl-lpspi: pass struct fsl_lpspi_data instead of struct spi_controller if possible
Instead of passing a spi_controller pointer to functions and using spi_controller_get_devdata() to get the struct fsl_lpspi_data pointer, directly pass a struct fsl_lpspi_data pointer. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20261009-spi-fsl-lpspi-more-cleanups-v1-1-2d4549d5205e@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
Marc Kleine-Budde <mkl@pengutronix.de> · 2026-10-09 10:16 UTC · committed by Mark Brown
9 files changed,
+24
−26
- drivers/spi/spi-fsl-lpspi.c
- drivers/spi/spi-imx.c
- drivers/spi/spi-tegra114.c
- fs/ocfs2/dlm/dlmcommon.h
- fs/ocfs2/dlm/dlmdebug.c
- fs/ocfs2/dlm/dlmrecovery.c
- fs/pipe.c
- include/linux/sched/signal.h
- samples/pidfd/Makefile
modified drivers/spi/spi-fsl-lpspi.c
| @@ -550,11 +550,8 @@ static int fsl_lpspi_target_abort(struct spi_controller *controller) | |||
| 550 | 550 | return 0; | |
| 551 | 551 | } | |
| 552 | 552 | ||
| 553 | - | static int fsl_lpspi_wait_for_completion(struct spi_controller *controller) | |
| 553 | + | static int fsl_lpspi_wait_for_completion(struct fsl_lpspi_data *fsl_lpspi) | |
| 554 | 554 | { | |
| 555 | - | struct fsl_lpspi_data *fsl_lpspi = | |
| 556 | - | spi_controller_get_devdata(controller); | |
| 557 | - | ||
| 558 | 555 | if (fsl_lpspi->is_target) { | |
| 559 | 556 | if (wait_for_completion_interruptible(&fsl_lpspi->xfer_done) || | |
| 560 | 557 | fsl_lpspi->target_aborted) { | |
| @@ -758,11 +755,9 @@ err: | |||
| 758 | 755 | return ret; | |
| 759 | 756 | } | |
| 760 | 757 | ||
| 761 | - | static int fsl_lpspi_pio_transfer(struct spi_controller *controller, | |
| 758 | + | static int fsl_lpspi_pio_transfer(struct fsl_lpspi_data *fsl_lpspi, | |
| 762 | 759 | struct spi_transfer *t) | |
| 763 | 760 | { | |
| 764 | - | struct fsl_lpspi_data *fsl_lpspi = | |
| 765 | - | spi_controller_get_devdata(controller); | |
| 766 | 761 | int ret; | |
| 767 | 762 | ||
| 768 | 763 | fsl_lpspi->tx_buf = t->tx_buf; | |
| @@ -774,7 +769,7 @@ static int fsl_lpspi_pio_transfer(struct spi_controller *controller, | |||
| 774 | 769 | ||
| 775 | 770 | fsl_lpspi_write_tx_fifo(fsl_lpspi); | |
| 776 | 771 | ||
| 777 | - | ret = fsl_lpspi_wait_for_completion(controller); | |
| 772 | + | ret = fsl_lpspi_wait_for_completion(fsl_lpspi); | |
| 778 | 773 | ||
| 779 | 774 | fsl_lpspi_reset(fsl_lpspi); | |
| 780 | 775 | ||
| @@ -803,7 +798,7 @@ static int fsl_lpspi_transfer_one(struct spi_controller *controller, | |||
| 803 | 798 | if (fsl_lpspi->usedma) | |
| 804 | 799 | ret = fsl_lpspi_dma_transfer(controller, fsl_lpspi, t); | |
| 805 | 800 | else | |
| 806 | - | ret = fsl_lpspi_pio_transfer(controller, t); | |
| 801 | + | ret = fsl_lpspi_pio_transfer(fsl_lpspi, t); | |
| 807 | 802 | if (ret < 0) | |
| 808 | 803 | return ret; | |
| 809 | 804 | ||
modified drivers/spi/spi-imx.c
| @@ -1578,11 +1578,13 @@ static int spi_imx_dma_tx_data_handle(struct spi_imx_data *spi_imx, | |||
| 1578 | 1578 | dma_data->dma_len = ALIGN(dma_data->data_len, BYTES_PER_32BITS_WORD); | |
| 1579 | 1579 | } | |
| 1580 | 1580 | ||
| 1581 | - | dma_data->dma_tx_buf = kzalloc(dma_data->dma_len, GFP_KERNEL); | |
| 1581 | + | dma_data->dma_tx_buf = kzalloc(DMA_CACHE_ALIGNED_LEN(dma_data->dma_len), | |
| 1582 | + | GFP_KERNEL); | |
| 1582 | 1583 | if (!dma_data->dma_tx_buf) | |
| 1583 | 1584 | return -ENOMEM; | |
| 1584 | 1585 | ||
| 1585 | - | dma_data->dma_rx_buf = kzalloc(dma_data->dma_len, GFP_KERNEL); | |
| 1586 | + | dma_data->dma_rx_buf = kzalloc(DMA_CACHE_ALIGNED_LEN(dma_data->dma_len), | |
| 1587 | + | GFP_KERNEL); | |
| 1586 | 1588 | if (!dma_data->dma_rx_buf) { | |
| 1587 | 1589 | kfree(dma_data->dma_tx_buf); | |
| 1588 | 1590 | return -ENOMEM; | |
| @@ -1920,7 +1922,8 @@ static int spi_imx_dma_package_transfer(struct spi_imx_data *spi_imx, | |||
| 1920 | 1922 | ||
| 1921 | 1923 | /* Trim the DMA RX buffer and copy the actual data to rx_buf */ | |
| 1922 | 1924 | dma_sync_single_for_cpu(controller->dma_rx->device->dev, dma_data->dma_rx_addr, | |
| 1923 | - | dma_data->dma_len, DMA_FROM_DEVICE); | |
| 1925 | + | DMA_CACHE_ALIGNED_LEN(dma_data->dma_len), | |
| 1926 | + | DMA_FROM_DEVICE); | |
| 1924 | 1927 | spi_imx_dma_rx_data_handle(spi_imx, dma_data, transfer->rx_buf + spi_imx->rx_offset, | |
| 1925 | 1928 | word_delay); | |
| 1926 | 1929 | spi_imx->rx_offset += dma_data->data_len; | |
modified drivers/spi/spi-tegra114.c
| @@ -859,6 +859,13 @@ static u32 tegra_spi_setup_transfer_one(struct spi_device *spi, | |||
| 859 | 859 | command1 |= SPI_BIT_LENGTH(bits_per_word - 1); | |
| 860 | 860 | } | |
| 861 | 861 | ||
| 862 | + | /* | |
| 863 | + | * Re-assert the CS GPIO for every transfer: transfer_end() drops it | |
| 864 | + | * on cs_change, and the assert above only covers is_first_of_msg. | |
| 865 | + | */ | |
| 866 | + | if (spi_get_csgpiod(spi, 0)) | |
| 867 | + | gpiod_set_value(spi_get_csgpiod(spi, 0), 1); | |
| 868 | + | ||
| 862 | 869 | return command1; | |
| 863 | 870 | } | |
| 864 | 871 | ||
modified fs/ocfs2/dlm/dlmcommon.h
| @@ -435,8 +435,6 @@ enum { | |||
| 435 | 435 | DLM_DEREF_LOCKRES_DONE = 522, | |
| 436 | 436 | }; | |
| 437 | 437 | ||
| 438 | - | extern spinlock_t dlm_reco_state_lock; | |
| 439 | - | ||
| 440 | 438 | struct dlm_reco_node_data | |
| 441 | 439 | { | |
| 442 | 440 | int state; | |
modified fs/ocfs2/dlm/dlmdebug.c
| @@ -736,11 +736,8 @@ static int debug_state_print(struct dlm_ctxt *dlm, char *buf, int len) | |||
| 736 | 736 | buf + out, len - out); | |
| 737 | 737 | out += scnprintf(buf + out, len - out, "\n"); | |
| 738 | 738 | ||
| 739 | - | spin_unlock(&dlm->spinlock); | |
| 740 | - | ||
| 741 | 739 | /* Recovery Node State: */ | |
| 742 | 740 | out += scnprintf(buf + out, len - out, "Recovery Node State:\n"); | |
| 743 | - | spin_lock(&dlm_reco_state_lock); | |
| 744 | 741 | list_for_each_entry(node, &dlm->reco.node_data, list) { | |
| 745 | 742 | switch (node->state) { | |
| 746 | 743 | case DLM_RECO_NODE_DATA_INIT: | |
| @@ -772,7 +769,7 @@ static int debug_state_print(struct dlm_ctxt *dlm, char *buf, int len) | |||
| 772 | 769 | node->node_num, state); | |
| 773 | 770 | } | |
| 774 | 771 | ||
| 775 | - | spin_unlock(&dlm_reco_state_lock); | |
| 772 | + | spin_unlock(&dlm->spinlock); | |
| 776 | 773 | ||
| 777 | 774 | return out; | |
| 778 | 775 | } | |
modified fs/ocfs2/dlm/dlmrecovery.c
| @@ -80,7 +80,7 @@ static int dlm_lockres_master_requery(struct dlm_ctxt *dlm, | |||
| 80 | 80 | ||
| 81 | 81 | static u64 dlm_get_next_mig_cookie(void); | |
| 82 | 82 | ||
| 83 | - | DEFINE_SPINLOCK(dlm_reco_state_lock); | |
| 83 | + | static DEFINE_SPINLOCK(dlm_reco_state_lock); | |
| 84 | 84 | static DEFINE_SPINLOCK(dlm_mig_cookie_lock); | |
| 85 | 85 | static u64 dlm_mig_cookie = 1; | |
| 86 | 86 | ||
modified fs/pipe.c
| @@ -838,11 +838,9 @@ pipe_fasync(int fd, struct file *filp, int on) | |||
| 838 | 838 | if (filp->f_mode & FMODE_READ) | |
| 839 | 839 | retval = fasync_helper(fd, filp, on, &pipe->fasync_readers); | |
| 840 | 840 | if ((filp->f_mode & FMODE_WRITE) && retval >= 0) { | |
| 841 | - | int read_ret = retval; | |
| 842 | - | ||
| 843 | 841 | retval = fasync_helper(fd, filp, on, &pipe->fasync_writers); | |
| 844 | - | /* Undo only a reader entry added by this call. */ | |
| 845 | - | if (retval < 0 && read_ret > 0) | |
| 842 | + | if (retval < 0 && (filp->f_mode & FMODE_READ)) | |
| 843 | + | /* this can happen only if on == T */ | |
| 846 | 844 | fasync_helper(-1, filp, 0, &pipe->fasync_readers); | |
| 847 | 845 | } | |
| 848 | 846 | mutex_unlock(&pipe->mutex); | |
modified include/linux/sched/signal.h
| @@ -130,8 +130,8 @@ struct signal_struct { | |||
| 130 | 130 | * process will inherit a flag if they should look for a | |
| 131 | 131 | * child_subreaper process at exit. | |
| 132 | 132 | */ | |
| 133 | - | bool is_child_subreaper; | |
| 134 | - | bool has_child_subreaper; | |
| 133 | + | unsigned int is_child_subreaper:1; | |
| 134 | + | unsigned int has_child_subreaper:1; | |
| 135 | 135 | unsigned int autoreap:1; | |
| 136 | 136 | ||
| 137 | 137 | #ifdef CONFIG_POSIX_TIMERS | |
modified samples/pidfd/Makefile
| @@ -1,4 +1,4 @@ | |||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 | |
| 2 | - | userprogs-always-y += pidfd-metadata | |
| 2 | + | usertprogs-always-y += pidfd-metadata | |
| 3 | 3 | ||
| 4 | 4 | userccflags += -I usr/include | |