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.

dmaengine: stm32-dma3: introduce ddata2dev helper

The purpose of this helper is to 'standardize' device pointer retrieval,
similar to the chan2dev() helper.
ddata2dev() helper returns the device pointer from struct dma_device stored
in stm32_dma3_ddata structure.
Device pointer from struct dma_device has been initialized with &pdev->dev,
so the ddata2dev helper returns &pdev->dev.

Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://patch.msgid.link/20251121-dma3_improv-v2-4-76a207b13ea6@foss.st.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Amelie Delaunay and committed by
Vinod Koul
8be4f3cb dea737e3

+17 -11
+17 -11
drivers/dma/stm32/stm32-dma3.c
··· 333 333 return &chan->vchan.chan.dev->device; 334 334 } 335 335 336 + static struct device *ddata2dev(struct stm32_dma3_ddata *ddata) 337 + { 338 + return ddata->dma_dev.dev; 339 + } 340 + 336 341 static void stm32_dma3_chan_dump_reg(struct stm32_dma3_chan *chan) 337 342 { 338 343 struct stm32_dma3_ddata *ddata = to_stm32_dma3_ddata(chan); ··· 1115 1110 struct stm32_dma3_ddata *ddata = to_stm32_dma3_ddata(chan); 1116 1111 int ret; 1117 1112 1118 - ret = pm_runtime_resume_and_get(ddata->dma_dev.dev); 1113 + ret = pm_runtime_resume_and_get(ddata2dev(ddata)); 1119 1114 if (ret < 0) 1120 1115 return ret; 1121 1116 ··· 1149 1144 chan->lli_pool = NULL; 1150 1145 1151 1146 err_put_sync: 1152 - pm_runtime_put_sync(ddata->dma_dev.dev); 1147 + pm_runtime_put_sync(ddata2dev(ddata)); 1153 1148 1154 1149 return ret; 1155 1150 } ··· 1175 1170 if (chan->semaphore_mode) 1176 1171 stm32_dma3_put_chan_sem(chan); 1177 1172 1178 - pm_runtime_put_sync(ddata->dma_dev.dev); 1173 + pm_runtime_put_sync(ddata2dev(ddata)); 1179 1174 1180 1175 /* Reset configuration */ 1181 1176 memset(&chan->dt_config, 0, sizeof(chan->dt_config)); ··· 1615 1610 if (!(mask & BIT(chan->id))) 1616 1611 return false; 1617 1612 1618 - ret = pm_runtime_resume_and_get(ddata->dma_dev.dev); 1613 + ret = pm_runtime_resume_and_get(ddata2dev(ddata)); 1619 1614 if (ret < 0) 1620 1615 return false; 1621 1616 semcr = readl_relaxed(ddata->base + STM32_DMA3_CSEMCR(chan->id)); 1622 - pm_runtime_put_sync(ddata->dma_dev.dev); 1617 + pm_runtime_put_sync(ddata2dev(ddata)); 1623 1618 1624 1619 /* Check if chan is free */ 1625 1620 if (semcr & CSEMCR_SEM_MUTEX) ··· 1641 1636 struct dma_chan *c; 1642 1637 1643 1638 if (dma_spec->args_count < 3) { 1644 - dev_err(ddata->dma_dev.dev, "Invalid args count\n"); 1639 + dev_err(ddata2dev(ddata), "Invalid args count\n"); 1645 1640 return NULL; 1646 1641 } 1647 1642 ··· 1650 1645 conf.tr_conf = dma_spec->args[2]; 1651 1646 1652 1647 if (conf.req_line >= ddata->dma_requests) { 1653 - dev_err(ddata->dma_dev.dev, "Invalid request line\n"); 1648 + dev_err(ddata2dev(ddata), "Invalid request line\n"); 1654 1649 return NULL; 1655 1650 } 1656 1651 1657 1652 /* Request dma channel among the generic dma controller list */ 1658 1653 c = dma_request_channel(mask, stm32_dma3_filter_fn, &conf); 1659 1654 if (!c) { 1660 - dev_err(ddata->dma_dev.dev, "No suitable channel found\n"); 1655 + dev_err(ddata2dev(ddata), "No suitable channel found\n"); 1661 1656 return NULL; 1662 1657 } 1663 1658 ··· 1670 1665 1671 1666 static u32 stm32_dma3_check_rif(struct stm32_dma3_ddata *ddata) 1672 1667 { 1668 + struct device *dev = ddata2dev(ddata); 1673 1669 u32 chan_reserved, mask = 0, i, ccidcfgr, invalid_cid = 0; 1674 1670 1675 1671 /* Reserve Secure channels */ ··· 1682 1676 * In case CID filtering is not configured, dma-channel-mask property can be used to 1683 1677 * specify available DMA channels to the kernel. 1684 1678 */ 1685 - of_property_read_u32(ddata->dma_dev.dev->of_node, "dma-channel-mask", &mask); 1679 + of_property_read_u32(dev->of_node, "dma-channel-mask", &mask); 1686 1680 1687 1681 /* Reserve !CID-filtered not in dma-channel-mask, static CID != CID1, CID1 not allowed */ 1688 1682 for (i = 0; i < ddata->dma_channels; i++) { ··· 1702 1696 ddata->chans[i].semaphore_mode = true; 1703 1697 } 1704 1698 } 1705 - dev_dbg(ddata->dma_dev.dev, "chan%d: %s mode, %s\n", i, 1699 + dev_dbg(dev, "chan%d: %s mode, %s\n", i, 1706 1700 !(ccidcfgr & CCIDCFGR_CFEN) ? "!CID-filtered" : 1707 1701 ddata->chans[i].semaphore_mode ? "Semaphore" : "Static CID", 1708 1702 (chan_reserved & BIT(i)) ? "denied" : ··· 1710 1704 } 1711 1705 1712 1706 if (invalid_cid) 1713 - dev_warn(ddata->dma_dev.dev, "chan%*pbl have invalid CID configuration\n", 1707 + dev_warn(dev, "chan%*pbl have invalid CID configuration\n", 1714 1708 ddata->dma_channels, &invalid_cid); 1715 1709 1716 1710 return chan_reserved;