* [PATCH 00/13] Unify device * to platform_device *
@ 2021-11-27 14:11 Fan Fei
2021-11-27 14:11 ` [PATCH 01/13] PCI: xilinx: Replace device * with " Fan Fei
` (13 more replies)
0 siblings, 14 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller structs contain "device *", while others contain
"platform_device *". These patches unify "device *dev" to
"platform_device *pdev" in 13 controller struct, to make the controller
struct more consistent. Consider that PCI controllers interact with
platform_device directly, not device, to enumerate the controlled device.
Fan Fei (13):
PCI: xilinx: Replace device * with platform_device *
PCI: mediatek: Replace device * with platform_device *
PCI: tegra: Replace device * with platform_device *
PCI: xegene: Replace device * with platform_device *
PCI: microchip: Replace device * with platform_device *
PCI: brcmstb: Replace device * with platform_device *
PCI: mediatek-gen3: Replace device * with platform_device *
PCI: rcar-gen2: Replace device * with platform_device *
PCI: ftpci100: Replace device * with platform_device *
PCI: v3-semi: Replace device * with platform_device *
PCI: ixp4xx: Replace device * with platform_device *
PCI: xilinx-nwl: Replace device * with platform_device *
PCI: rcar: Replace device * with platform_device *
drivers/pci/controller/pci-ftpci100.c | 15 +-
drivers/pci/controller/pci-ixp4xx.c | 47 ++--
drivers/pci/controller/pci-rcar-gen2.c | 10 +-
drivers/pci/controller/pci-tegra.c | 85 +++----
drivers/pci/controller/pci-v3-semi.c | 19 +-
drivers/pci/controller/pci-xgene.c | 222 +++++++++----------
drivers/pci/controller/pcie-brcmstb.c | 35 +--
drivers/pci/controller/pcie-mediatek-gen3.c | 36 +--
drivers/pci/controller/pcie-mediatek.c | 31 +--
drivers/pci/controller/pcie-microchip-host.c | 18 +-
drivers/pci/controller/pcie-rcar-ep.c | 40 ++--
drivers/pci/controller/pcie-rcar-host.c | 27 +--
drivers/pci/controller/pcie-rcar.h | 2 +-
drivers/pci/controller/pcie-xilinx-nwl.c | 28 +--
drivers/pci/controller/pcie-xilinx.c | 21 +-
15 files changed, 328 insertions(+), 308 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 01/13] PCI: xilinx: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-11-27 14:11 ` [PATCH 02/13] PCI: mediatek: " Fan Fei
` (12 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
"struct xilinx_pcie", because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pcie-xilinx.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/pci/controller/pcie-xilinx.c b/drivers/pci/controller/pcie-xilinx.c
index 1e7928d81a05..9137e440b4d3 100644
--- a/drivers/pci/controller/pcie-xilinx.c
+++ b/drivers/pci/controller/pcie-xilinx.c
@@ -101,8 +101,8 @@
* @resources: Bus Resources
*/
struct xilinx_pcie {
+ struct platform_device *pdev;
void __iomem *reg_base;
- struct device *dev;
unsigned long msi_map[BITS_TO_LONGS(XILINX_NUM_MSI_IRQS)];
struct mutex map_lock;
struct irq_domain *msi_domain;
@@ -132,7 +132,7 @@ static inline bool xilinx_pcie_link_up(struct xilinx_pcie *pcie)
*/
static void xilinx_pcie_clear_err_interrupts(struct xilinx_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
unsigned long val = pcie_read(pcie, XILINX_PCIE_REG_RPEFR);
if (val & XILINX_PCIE_RPEFR_ERR_VALID) {
@@ -277,20 +277,21 @@ static struct msi_domain_info xilinx_msi_info = {
static int xilinx_allocate_msi_domains(struct xilinx_pcie *pcie)
{
- struct fwnode_handle *fwnode = dev_fwnode(pcie->dev);
+ struct device *dev = &pcie->pdev->dev;
+ struct fwnode_handle *fwnode = dev_fwnode(dev);
struct irq_domain *parent;
parent = irq_domain_create_linear(fwnode, XILINX_NUM_MSI_IRQS,
&xilinx_msi_domain_ops, pcie);
if (!parent) {
- dev_err(pcie->dev, "failed to create IRQ domain\n");
+ dev_err(dev, "failed to create IRQ domain\n");
return -ENOMEM;
}
irq_domain_update_bus_token(parent, DOMAIN_BUS_NEXUS);
pcie->msi_domain = pci_msi_create_irq_domain(fwnode, &xilinx_msi_info, parent);
if (!pcie->msi_domain) {
- dev_err(pcie->dev, "failed to create MSI domain\n");
+ dev_err(dev, "failed to create MSI domain\n");
irq_domain_remove(parent);
return -ENOMEM;
}
@@ -343,7 +344,7 @@ static const struct irq_domain_ops intx_domain_ops = {
static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
{
struct xilinx_pcie *pcie = (struct xilinx_pcie *)data;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
u32 val, mask, status;
/* Read interrupt decode and mask registers */
@@ -455,7 +456,7 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
*/
static int xilinx_pcie_init_irq_domain(struct xilinx_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct device_node *pcie_intc_node;
int ret;
@@ -496,7 +497,7 @@ static int xilinx_pcie_init_irq_domain(struct xilinx_pcie *pcie)
*/
static void xilinx_pcie_init_port(struct xilinx_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
if (xilinx_pcie_link_up(pcie))
dev_info(dev, "PCIe Link is UP\n");
@@ -529,7 +530,7 @@ static void xilinx_pcie_init_port(struct xilinx_pcie *pcie)
*/
static int xilinx_pcie_parse_dt(struct xilinx_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct device_node *node = dev->of_node;
struct resource regs;
unsigned int irq;
@@ -579,7 +580,7 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
pcie = pci_host_bridge_priv(bridge);
mutex_init(&pcie->map_lock);
- pcie->dev = dev;
+ pcie->pdev = pdev;
err = xilinx_pcie_parse_dt(pcie);
if (err) {
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 02/13] PCI: mediatek: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
2021-11-27 14:11 ` [PATCH 01/13] PCI: xilinx: Replace device * with " Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-11-27 14:11 ` [PATCH 03/13] PCI: tegra: " Fan Fei
` (11 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct mediatek_pcie, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pcie-mediatek.c | 31 +++++++++++++-------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
index 2f3f974977a3..9e49d3ee9cff 100644
--- a/drivers/pci/controller/pcie-mediatek.c
+++ b/drivers/pci/controller/pcie-mediatek.c
@@ -216,7 +216,7 @@ struct mtk_pcie_port {
* @soc: pointer to SoC-dependent operations
*/
struct mtk_pcie {
- struct device *dev;
+ struct platform_device *pdev;
void __iomem *base;
struct regmap *cfg;
struct clk *free_ck;
@@ -227,7 +227,7 @@ struct mtk_pcie {
static void mtk_pcie_subsys_powerdown(struct mtk_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
clk_disable_unprepare(pcie->free_ck);
@@ -238,7 +238,7 @@ static void mtk_pcie_subsys_powerdown(struct mtk_pcie *pcie)
static void mtk_pcie_port_free(struct mtk_pcie_port *port)
{
struct mtk_pcie *pcie = port->pcie;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
devm_iounmap(dev, port->base);
list_del(&port->list);
@@ -410,7 +410,7 @@ static void mtk_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
msg->data = data->hwirq;
- dev_dbg(port->pcie->dev, "msi#%d address_hi %#x address_lo %#x\n",
+ dev_dbg(&port->pcie->pdev->dev, "msi#%d address_hi %#x address_lo %#x\n",
(int)data->hwirq, msg->address_hi, msg->address_lo);
}
@@ -470,7 +470,7 @@ static void mtk_pcie_irq_domain_free(struct irq_domain *domain,
mutex_lock(&port->lock);
if (!test_bit(d->hwirq, port->msi_irq_in_use))
- dev_err(port->pcie->dev, "trying to free unused MSI#%lu\n",
+ dev_err(&port->pcie->pdev->dev, "trying to free unused MSI#%lu\n",
d->hwirq);
else
__clear_bit(d->hwirq, port->msi_irq_in_use);
@@ -500,21 +500,22 @@ static struct msi_domain_info mtk_msi_domain_info = {
static int mtk_pcie_allocate_msi_domains(struct mtk_pcie_port *port)
{
- struct fwnode_handle *fwnode = of_node_to_fwnode(port->pcie->dev->of_node);
+ struct device *dev = &port->pcie->pdev->dev;
+ struct fwnode_handle *fwnode = of_node_to_fwnode(dev->of_node);
mutex_init(&port->lock);
port->inner_domain = irq_domain_create_linear(fwnode, MTK_MSI_IRQS_NUM,
&msi_domain_ops, port);
if (!port->inner_domain) {
- dev_err(port->pcie->dev, "failed to create IRQ domain\n");
+ dev_err(dev, "failed to create IRQ domain\n");
return -ENOMEM;
}
port->msi_domain = pci_msi_create_irq_domain(fwnode, &mtk_msi_domain_info,
port->inner_domain);
if (!port->msi_domain) {
- dev_err(port->pcie->dev, "failed to create MSI domain\n");
+ dev_err(dev, "failed to create MSI domain\n");
irq_domain_remove(port->inner_domain);
return -ENOMEM;
}
@@ -573,7 +574,7 @@ static const struct irq_domain_ops intx_domain_ops = {
static int mtk_pcie_init_irq_domain(struct mtk_pcie_port *port,
struct device_node *node)
{
- struct device *dev = port->pcie->dev;
+ struct device *dev = &port->pcie->pdev->dev;
struct device_node *pcie_intc_node;
int ret;
@@ -640,7 +641,7 @@ static int mtk_pcie_setup_irq(struct mtk_pcie_port *port,
struct device_node *node)
{
struct mtk_pcie *pcie = port->pcie;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct platform_device *pdev = to_platform_device(dev);
int err;
@@ -830,7 +831,7 @@ static int mtk_pcie_startup_port(struct mtk_pcie_port *port)
static void mtk_pcie_enable_port(struct mtk_pcie_port *port)
{
struct mtk_pcie *pcie = port->pcie;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
int err;
err = clk_prepare_enable(port->sys_ck);
@@ -913,7 +914,7 @@ static int mtk_pcie_parse_port(struct mtk_pcie *pcie,
int slot)
{
struct mtk_pcie_port *port;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct platform_device *pdev = to_platform_device(dev);
char name[10];
int err;
@@ -990,7 +991,7 @@ static int mtk_pcie_parse_port(struct mtk_pcie *pcie,
static int mtk_pcie_subsys_powerup(struct mtk_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct platform_device *pdev = to_platform_device(dev);
struct resource *regs;
struct device_node *cfg_node;
@@ -1041,7 +1042,7 @@ static int mtk_pcie_subsys_powerup(struct mtk_pcie *pcie)
static int mtk_pcie_setup(struct mtk_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct device_node *node = dev->of_node, *child;
struct mtk_pcie_port *port, *tmp;
int err, slot;
@@ -1098,7 +1099,7 @@ static int mtk_pcie_probe(struct platform_device *pdev)
pcie = pci_host_bridge_priv(host);
- pcie->dev = dev;
+ pcie->pdev = pdev;
pcie->soc = of_device_get_match_data(dev);
platform_set_drvdata(pdev, pcie);
INIT_LIST_HEAD(&pcie->ports);
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 03/13] PCI: tegra: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
2021-11-27 14:11 ` [PATCH 01/13] PCI: xilinx: Replace device * with " Fan Fei
2021-11-27 14:11 ` [PATCH 02/13] PCI: mediatek: " Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-11-27 14:11 ` [PATCH 04/13] PCI: xegene: " Fan Fei
` (10 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct tegra_pcie, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pci-tegra.c | 85 +++++++++++++++---------------
1 file changed, 43 insertions(+), 42 deletions(-)
diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index cb0aa65d6934..0dce4c303db7 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -320,7 +320,7 @@ struct tegra_pcie_soc {
};
struct tegra_pcie {
- struct device *dev;
+ struct platform_device *pdev;
void __iomem *pads;
void __iomem *afi;
@@ -714,7 +714,7 @@ static void tegra_pcie_port_disable(struct tegra_pcie_port *port)
static void tegra_pcie_port_free(struct tegra_pcie_port *port)
{
struct tegra_pcie *pcie = port->pcie;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
devm_iounmap(dev, port->base);
devm_release_mem_region(dev, port->regs.start,
@@ -777,7 +777,7 @@ static irqreturn_t tegra_pcie_isr(int irq, void *arg)
"Peer2Peer error",
};
struct tegra_pcie *pcie = arg;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
u32 code, signature;
code = afi_readl(pcie, AFI_INTR_CODE) & AFI_INTR_CODE_MASK;
@@ -909,7 +909,7 @@ static int tegra_pcie_pll_wait(struct tegra_pcie *pcie, unsigned long timeout)
static int tegra_pcie_phy_enable(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
const struct tegra_pcie_soc *soc = pcie->soc;
u32 value;
int err;
@@ -990,7 +990,7 @@ static int tegra_pcie_phy_disable(struct tegra_pcie *pcie)
static int tegra_pcie_port_phy_power_on(struct tegra_pcie_port *port)
{
- struct device *dev = port->pcie->dev;
+ struct device *dev = &port->pcie->pdev->dev;
unsigned int i;
int err;
@@ -1007,7 +1007,7 @@ static int tegra_pcie_port_phy_power_on(struct tegra_pcie_port *port)
static int tegra_pcie_port_phy_power_off(struct tegra_pcie_port *port)
{
- struct device *dev = port->pcie->dev;
+ struct device *dev = &port->pcie->pdev->dev;
unsigned int i;
int err;
@@ -1025,7 +1025,7 @@ static int tegra_pcie_port_phy_power_off(struct tegra_pcie_port *port)
static int tegra_pcie_phy_power_on(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct tegra_pcie_port *port;
int err;
@@ -1056,7 +1056,7 @@ static int tegra_pcie_phy_power_on(struct tegra_pcie *pcie)
static int tegra_pcie_phy_power_off(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct tegra_pcie_port *port;
int err;
@@ -1151,7 +1151,7 @@ static void tegra_pcie_enable_controller(struct tegra_pcie *pcie)
static void tegra_pcie_power_off(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
const struct tegra_pcie_soc *soc = pcie->soc;
int err;
@@ -1172,7 +1172,7 @@ static void tegra_pcie_power_off(struct tegra_pcie *pcie)
static int tegra_pcie_power_on(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
const struct tegra_pcie_soc *soc = pcie->soc;
int err;
@@ -1252,7 +1252,7 @@ static void tegra_pcie_apply_pad_settings(struct tegra_pcie *pcie)
static int tegra_pcie_clocks_get(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
const struct tegra_pcie_soc *soc = pcie->soc;
pcie->pex_clk = devm_clk_get(dev, "pex");
@@ -1278,7 +1278,7 @@ static int tegra_pcie_clocks_get(struct tegra_pcie *pcie)
static int tegra_pcie_resets_get(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
pcie->pex_rst = devm_reset_control_get_exclusive(dev, "pex");
if (IS_ERR(pcie->pex_rst))
@@ -1297,7 +1297,7 @@ static int tegra_pcie_resets_get(struct tegra_pcie *pcie)
static int tegra_pcie_phys_get_legacy(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
int err;
pcie->phy = devm_phy_optional_get(dev, "pcie");
@@ -1341,7 +1341,7 @@ static struct phy *devm_of_phy_optional_get_index(struct device *dev,
static int tegra_pcie_port_get_phys(struct tegra_pcie_port *port)
{
- struct device *dev = port->pcie->dev;
+ struct device *dev = &port->pcie->pdev->dev;
struct phy *phy;
unsigned int i;
int err;
@@ -1374,7 +1374,7 @@ static int tegra_pcie_port_get_phys(struct tegra_pcie_port *port)
static int tegra_pcie_phys_get(struct tegra_pcie *pcie)
{
const struct tegra_pcie_soc *soc = pcie->soc;
- struct device_node *np = pcie->dev->of_node;
+ struct device_node *np = pcie->pdev->dev.of_node;
struct tegra_pcie_port *port;
int err;
@@ -1393,7 +1393,7 @@ static int tegra_pcie_phys_get(struct tegra_pcie *pcie)
static void tegra_pcie_phys_put(struct tegra_pcie *pcie)
{
struct tegra_pcie_port *port;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
int err, i;
if (pcie->legacy_phy) {
@@ -1415,8 +1415,8 @@ static void tegra_pcie_phys_put(struct tegra_pcie *pcie)
static int tegra_pcie_get_resources(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
- struct platform_device *pdev = to_platform_device(dev);
+ struct platform_device *pdev = pcie->pdev;
+ struct device *dev = &pdev->dev;
struct resource *res;
const struct tegra_pcie_soc *soc = pcie->soc;
int err;
@@ -1522,7 +1522,7 @@ static void tegra_pcie_pme_turnoff(struct tegra_pcie_port *port)
err = readl_poll_timeout(pcie->afi + AFI_PCIE_PME, val,
val & (0x1 << ack_bit), 1, PME_ACK_TIMEOUT);
if (err)
- dev_err(pcie->dev, "PME Ack is not received on port: %d\n",
+ dev_err(&pcie->pdev->dev, "PME Ack is not received on port: %d\n",
port->index);
usleep_range(10000, 11000);
@@ -1537,7 +1537,7 @@ static void tegra_pcie_msi_irq(struct irq_desc *desc)
struct tegra_pcie *pcie = irq_desc_get_handler_data(desc);
struct irq_chip *chip = irq_desc_get_chip(desc);
struct tegra_msi *msi = &pcie->msi;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
unsigned int i;
chained_irq_enter(chip, desc);
@@ -1708,20 +1708,21 @@ static struct msi_domain_info tegra_msi_info = {
static int tegra_allocate_domains(struct tegra_msi *msi)
{
struct tegra_pcie *pcie = msi_to_pcie(msi);
- struct fwnode_handle *fwnode = dev_fwnode(pcie->dev);
+ struct device *dev = &pcie->pdev->dev;
+ struct fwnode_handle *fwnode = dev_fwnode(dev);
struct irq_domain *parent;
parent = irq_domain_create_linear(fwnode, INT_PCI_MSI_NR,
&tegra_msi_domain_ops, msi);
if (!parent) {
- dev_err(pcie->dev, "failed to create IRQ domain\n");
+ dev_err(dev, "failed to create IRQ domain\n");
return -ENOMEM;
}
irq_domain_update_bus_token(parent, DOMAIN_BUS_NEXUS);
msi->domain = pci_msi_create_irq_domain(fwnode, &tegra_msi_info, parent);
if (!msi->domain) {
- dev_err(pcie->dev, "failed to create MSI domain\n");
+ dev_err(dev, "failed to create MSI domain\n");
irq_domain_remove(parent);
return -ENOMEM;
}
@@ -1739,9 +1740,9 @@ static void tegra_free_domains(struct tegra_msi *msi)
static int tegra_pcie_msi_setup(struct tegra_pcie *pcie)
{
- struct platform_device *pdev = to_platform_device(pcie->dev);
+ struct platform_device *pdev = pcie->pdev;
+ struct device *dev = &pdev->dev;
struct tegra_msi *msi = &pcie->msi;
- struct device *dev = pcie->dev;
int err;
mutex_init(&msi->map_lock);
@@ -1819,7 +1820,7 @@ static void tegra_pcie_msi_teardown(struct tegra_pcie *pcie)
struct tegra_msi *msi = &pcie->msi;
unsigned int i, irq;
- dma_free_attrs(pcie->dev, PAGE_SIZE, msi->virt, msi->phys,
+ dma_free_attrs(&pcie->pdev->dev, PAGE_SIZE, msi->virt, msi->phys,
DMA_ATTR_NO_KERNEL_MAPPING);
for (i = 0; i < INT_PCI_MSI_NR; i++) {
@@ -1858,7 +1859,7 @@ static void tegra_pcie_disable_interrupts(struct tegra_pcie *pcie)
static int tegra_pcie_get_xbar_config(struct tegra_pcie *pcie, u32 lanes,
u32 *xbar)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct device_node *np = dev->of_node;
if (of_device_is_compatible(np, "nvidia,tegra186-pcie")) {
@@ -1963,7 +1964,7 @@ static bool of_regulator_bulk_available(struct device_node *np,
*/
static int tegra_pcie_get_legacy_regulators(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct device_node *np = dev->of_node;
if (of_device_is_compatible(np, "nvidia,tegra30-pcie"))
@@ -2002,14 +2003,14 @@ static int tegra_pcie_get_legacy_regulators(struct tegra_pcie *pcie)
*/
static int tegra_pcie_get_regulators(struct tegra_pcie *pcie, u32 lane_mask)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct device_node *np = dev->of_node;
unsigned int i = 0;
if (of_device_is_compatible(np, "nvidia,tegra186-pcie")) {
pcie->num_supplies = 4;
- pcie->supplies = devm_kcalloc(pcie->dev, pcie->num_supplies,
+ pcie->supplies = devm_kcalloc(dev, pcie->num_supplies,
sizeof(*pcie->supplies),
GFP_KERNEL);
if (!pcie->supplies)
@@ -2022,7 +2023,7 @@ static int tegra_pcie_get_regulators(struct tegra_pcie *pcie, u32 lane_mask)
} else if (of_device_is_compatible(np, "nvidia,tegra210-pcie")) {
pcie->num_supplies = 3;
- pcie->supplies = devm_kcalloc(pcie->dev, pcie->num_supplies,
+ pcie->supplies = devm_kcalloc(dev, pcie->num_supplies,
sizeof(*pcie->supplies),
GFP_KERNEL);
if (!pcie->supplies)
@@ -2114,7 +2115,7 @@ static int tegra_pcie_get_regulators(struct tegra_pcie *pcie, u32 lane_mask)
static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct device_node *np = dev->of_node, *port;
const struct tegra_pcie_soc *soc = pcie->soc;
u32 lanes = 0, mask = 0;
@@ -2245,7 +2246,7 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
#define TEGRA_PCIE_LINKUP_TIMEOUT 200 /* up to 1.2 seconds */
static bool tegra_pcie_port_check_link(struct tegra_pcie_port *port)
{
- struct device *dev = port->pcie->dev;
+ struct device *dev = &port->pcie->pdev->dev;
unsigned int retries = 3;
unsigned long value;
@@ -2292,7 +2293,7 @@ static bool tegra_pcie_port_check_link(struct tegra_pcie_port *port)
static void tegra_pcie_change_link_speed(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct tegra_pcie_port *port;
ktime_t deadline;
u32 value;
@@ -2350,7 +2351,7 @@ static void tegra_pcie_change_link_speed(struct tegra_pcie *pcie)
static void tegra_pcie_enable_ports(struct tegra_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct tegra_pcie_port *port, *tmp;
list_for_each_entry_safe(port, tmp, &pcie->ports, list) {
@@ -2634,7 +2635,7 @@ static int tegra_pcie_probe(struct platform_device *pdev)
pcie->soc = of_device_get_match_data(dev);
INIT_LIST_HEAD(&pcie->ports);
- pcie->dev = dev;
+ pcie->pdev = pdev;
err = tegra_pcie_parse_dt(pcie);
if (err < 0)
@@ -2652,8 +2653,8 @@ static int tegra_pcie_probe(struct platform_device *pdev)
goto put_resources;
}
- pm_runtime_enable(pcie->dev);
- err = pm_runtime_get_sync(pcie->dev);
+ pm_runtime_enable(&pcie->pdev->dev);
+ err = pm_runtime_get_sync(&pcie->pdev->dev);
if (err < 0) {
dev_err(dev, "fail to enable pcie controller: %d\n", err);
goto pm_runtime_put;
@@ -2674,8 +2675,8 @@ static int tegra_pcie_probe(struct platform_device *pdev)
return 0;
pm_runtime_put:
- pm_runtime_put_sync(pcie->dev);
- pm_runtime_disable(pcie->dev);
+ pm_runtime_put_sync(&pcie->pdev->dev);
+ pm_runtime_disable(&pcie->pdev->dev);
tegra_pcie_msi_teardown(pcie);
put_resources:
tegra_pcie_put_resources(pcie);
@@ -2693,8 +2694,8 @@ static int tegra_pcie_remove(struct platform_device *pdev)
pci_stop_root_bus(host->bus);
pci_remove_root_bus(host->bus);
- pm_runtime_put_sync(pcie->dev);
- pm_runtime_disable(pcie->dev);
+ pm_runtime_put_sync(&pcie->pdev->dev);
+ pm_runtime_disable(&pcie->pdev->dev);
if (IS_ENABLED(CONFIG_PCI_MSI))
tegra_pcie_msi_teardown(pcie);
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 04/13] PCI: xegene: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
` (2 preceding siblings ...)
2021-11-27 14:11 ` [PATCH 03/13] PCI: tegra: " Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-11-27 14:11 ` [PATCH 05/13] PCI: microchip: " Fan Fei
` (9 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct xgene_pcie, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pci-xgene.c | 222 ++++++++++++++---------------
1 file changed, 111 insertions(+), 111 deletions(-)
diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
index ba11f369a1c9..f66abd60058b 100644
--- a/drivers/pci/controller/pci-xgene.c
+++ b/drivers/pci/controller/pci-xgene.c
@@ -61,8 +61,8 @@
#if defined(CONFIG_PCI_XGENE) || (defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS))
struct xgene_pcie {
+ struct platform_device *pdev;
struct device_node *node;
- struct device *dev;
struct clk *clk;
void __iomem *csr_base;
void __iomem *cfg_base;
@@ -71,14 +71,14 @@ struct xgene_pcie {
u32 version;
};
-static u32 xgene_pcie_readl(struct xgene_pcie *port, u32 reg)
+static u32 xgene_pcie_readl(struct xgene_pcie *pcie, u32 reg)
{
- return readl(port->csr_base + reg);
+ return readl(pcie->csr_base + reg);
}
-static void xgene_pcie_writel(struct xgene_pcie *port, u32 reg, u32 val)
+static void xgene_pcie_writel(struct xgene_pcie *pcie, u32 reg, u32 val)
{
- writel(val, port->csr_base + reg);
+ writel(val, pcie->csr_base + reg);
}
static inline u32 pcie_bar_low_val(u32 addr, u32 flags)
@@ -103,12 +103,12 @@ static inline struct xgene_pcie *pcie_bus_to_port(struct pci_bus *bus)
*/
static void __iomem *xgene_pcie_get_cfg_base(struct pci_bus *bus)
{
- struct xgene_pcie *port = pcie_bus_to_port(bus);
+ struct xgene_pcie *pcie = pcie_bus_to_port(bus);
if (bus->number >= (bus->primary + 1))
- return port->cfg_base + AXI_EP_CFG_ACCESS;
+ return pcie->cfg_base + AXI_EP_CFG_ACCESS;
- return port->cfg_base;
+ return pcie->cfg_base;
}
/*
@@ -117,7 +117,7 @@ static void __iomem *xgene_pcie_get_cfg_base(struct pci_bus *bus)
*/
static void xgene_pcie_set_rtdid_reg(struct pci_bus *bus, uint devfn)
{
- struct xgene_pcie *port = pcie_bus_to_port(bus);
+ struct xgene_pcie *pcie = pcie_bus_to_port(bus);
unsigned int b, d, f;
u32 rtdid_val = 0;
@@ -128,9 +128,9 @@ static void xgene_pcie_set_rtdid_reg(struct pci_bus *bus, uint devfn)
if (!pci_is_root_bus(bus))
rtdid_val = (b << 8) | (d << 3) | f;
- xgene_pcie_writel(port, RTDID, rtdid_val);
+ xgene_pcie_writel(pcie, RTDID, rtdid_val);
/* read the register back to ensure flush */
- xgene_pcie_readl(port, RTDID);
+ xgene_pcie_readl(pcie, RTDID);
}
/*
@@ -164,7 +164,7 @@ static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
static int xgene_pcie_config_read32(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 *val)
{
- struct xgene_pcie *port = pcie_bus_to_port(bus);
+ struct xgene_pcie *pcie = pcie_bus_to_port(bus);
if (pci_generic_config_read32(bus, devfn, where & ~0x3, 4, val) !=
PCIBIOS_SUCCESSFUL)
@@ -180,7 +180,7 @@ static int xgene_pcie_config_read32(struct pci_bus *bus, unsigned int devfn,
* the read until it times out. Avoid this by not claiming to
* support CRS SV.
*/
- if (pci_is_root_bus(bus) && (port->version == XGENE_PCIE_IP_VER_1) &&
+ if (pci_is_root_bus(bus) && (pcie->version == XGENE_PCIE_IP_VER_1) &&
((where & ~0x3) == XGENE_V1_PCI_EXP_CAP + PCI_EXP_RTCTL))
*val &= ~(PCI_EXP_RTCAP_CRSVIS << 16);
@@ -227,12 +227,12 @@ static int xgene_pcie_ecam_init(struct pci_config_window *cfg, u32 ipversion)
{
struct device *dev = cfg->parent;
struct acpi_device *adev = to_acpi_device(dev);
- struct xgene_pcie *port;
+ struct xgene_pcie *pcie;
struct resource csr;
int ret;
- port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
- if (!port)
+ pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
+ if (!pcie)
return -ENOMEM;
ret = xgene_get_csr_resource(adev, &csr);
@@ -240,14 +240,14 @@ static int xgene_pcie_ecam_init(struct pci_config_window *cfg, u32 ipversion)
dev_err(dev, "can't get CSR resource\n");
return ret;
}
- port->csr_base = devm_pci_remap_cfg_resource(dev, &csr);
- if (IS_ERR(port->csr_base))
- return PTR_ERR(port->csr_base);
+ pcie->csr_base = devm_pci_remap_cfg_resource(dev, &csr);
+ if (IS_ERR(pcie->csr_base))
+ return PTR_ERR(pcie->csr_base);
- port->cfg_base = cfg->win;
- port->version = ipversion;
+ pcie->cfg_base = cfg->win;
+ pcie->version = ipversion;
- cfg->priv = port;
+ cfg->priv = pcie;
return 0;
}
@@ -281,59 +281,59 @@ const struct pci_ecam_ops xgene_v2_pcie_ecam_ops = {
#endif
#if defined(CONFIG_PCI_XGENE)
-static u64 xgene_pcie_set_ib_mask(struct xgene_pcie *port, u32 addr,
+static u64 xgene_pcie_set_ib_mask(struct xgene_pcie *pcie, u32 addr,
u32 flags, u64 size)
{
u64 mask = (~(size - 1) & PCI_BASE_ADDRESS_MEM_MASK) | flags;
u32 val32 = 0;
u32 val;
- val32 = xgene_pcie_readl(port, addr);
+ val32 = xgene_pcie_readl(pcie, addr);
val = (val32 & 0x0000ffff) | (lower_32_bits(mask) << 16);
- xgene_pcie_writel(port, addr, val);
+ xgene_pcie_writel(pcie, addr, val);
- val32 = xgene_pcie_readl(port, addr + 0x04);
+ val32 = xgene_pcie_readl(pcie, addr + 0x04);
val = (val32 & 0xffff0000) | (lower_32_bits(mask) >> 16);
- xgene_pcie_writel(port, addr + 0x04, val);
+ xgene_pcie_writel(pcie, addr + 0x04, val);
- val32 = xgene_pcie_readl(port, addr + 0x04);
+ val32 = xgene_pcie_readl(pcie, addr + 0x04);
val = (val32 & 0x0000ffff) | (upper_32_bits(mask) << 16);
- xgene_pcie_writel(port, addr + 0x04, val);
+ xgene_pcie_writel(pcie, addr + 0x04, val);
- val32 = xgene_pcie_readl(port, addr + 0x08);
+ val32 = xgene_pcie_readl(pcie, addr + 0x08);
val = (val32 & 0xffff0000) | (upper_32_bits(mask) >> 16);
- xgene_pcie_writel(port, addr + 0x08, val);
+ xgene_pcie_writel(pcie, addr + 0x08, val);
return mask;
}
-static void xgene_pcie_linkup(struct xgene_pcie *port,
+static void xgene_pcie_linkup(struct xgene_pcie *pcie,
u32 *lanes, u32 *speed)
{
u32 val32;
- port->link_up = false;
- val32 = xgene_pcie_readl(port, PCIECORE_CTLANDSTATUS);
+ pcie->link_up = false;
+ val32 = xgene_pcie_readl(pcie, PCIECORE_CTLANDSTATUS);
if (val32 & LINK_UP_MASK) {
- port->link_up = true;
+ pcie->link_up = true;
*speed = PIPE_PHY_RATE_RD(val32);
- val32 = xgene_pcie_readl(port, BRIDGE_STATUS_0);
+ val32 = xgene_pcie_readl(pcie, BRIDGE_STATUS_0);
*lanes = val32 >> 26;
}
}
-static int xgene_pcie_init_port(struct xgene_pcie *port)
+static int xgene_pcie_init_port(struct xgene_pcie *pcie)
{
- struct device *dev = port->dev;
+ struct device *dev = &pcie->pdev->dev;
int rc;
- port->clk = clk_get(dev, NULL);
- if (IS_ERR(port->clk)) {
+ pcie->clk = clk_get(dev, NULL);
+ if (IS_ERR(pcie->clk)) {
dev_err(dev, "clock not available\n");
return -ENODEV;
}
- rc = clk_prepare_enable(port->clk);
+ rc = clk_prepare_enable(pcie->clk);
if (rc) {
dev_err(dev, "clock enable failed\n");
return rc;
@@ -342,31 +342,31 @@ static int xgene_pcie_init_port(struct xgene_pcie *port)
return 0;
}
-static int xgene_pcie_map_reg(struct xgene_pcie *port,
+static int xgene_pcie_map_reg(struct xgene_pcie *pcie,
struct platform_device *pdev)
{
- struct device *dev = port->dev;
+ struct device *dev = &pdev->dev;
struct resource *res;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "csr");
- port->csr_base = devm_pci_remap_cfg_resource(dev, res);
- if (IS_ERR(port->csr_base))
- return PTR_ERR(port->csr_base);
+ pcie->csr_base = devm_pci_remap_cfg_resource(dev, res);
+ if (IS_ERR(pcie->csr_base))
+ return PTR_ERR(pcie->csr_base);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
- port->cfg_base = devm_ioremap_resource(dev, res);
- if (IS_ERR(port->cfg_base))
- return PTR_ERR(port->cfg_base);
- port->cfg_addr = res->start;
+ pcie->cfg_base = devm_ioremap_resource(dev, res);
+ if (IS_ERR(pcie->cfg_base))
+ return PTR_ERR(pcie->cfg_base);
+ pcie->cfg_addr = res->start;
return 0;
}
-static void xgene_pcie_setup_ob_reg(struct xgene_pcie *port,
+static void xgene_pcie_setup_ob_reg(struct xgene_pcie *pcie,
struct resource *res, u32 offset,
u64 cpu_addr, u64 pci_addr)
{
- struct device *dev = port->dev;
+ struct device *dev = &pcie->pdev->dev;
resource_size_t size = resource_size(res);
u64 restype = resource_type(res);
u64 mask = 0;
@@ -386,28 +386,28 @@ static void xgene_pcie_setup_ob_reg(struct xgene_pcie *port,
dev_warn(dev, "res size 0x%llx less than minimum 0x%x\n",
(u64)size, min_size);
- xgene_pcie_writel(port, offset, lower_32_bits(cpu_addr));
- xgene_pcie_writel(port, offset + 0x04, upper_32_bits(cpu_addr));
- xgene_pcie_writel(port, offset + 0x08, lower_32_bits(mask));
- xgene_pcie_writel(port, offset + 0x0c, upper_32_bits(mask));
- xgene_pcie_writel(port, offset + 0x10, lower_32_bits(pci_addr));
- xgene_pcie_writel(port, offset + 0x14, upper_32_bits(pci_addr));
+ xgene_pcie_writel(pcie, offset, lower_32_bits(cpu_addr));
+ xgene_pcie_writel(pcie, offset + 0x04, upper_32_bits(cpu_addr));
+ xgene_pcie_writel(pcie, offset + 0x08, lower_32_bits(mask));
+ xgene_pcie_writel(pcie, offset + 0x0c, upper_32_bits(mask));
+ xgene_pcie_writel(pcie, offset + 0x10, lower_32_bits(pci_addr));
+ xgene_pcie_writel(pcie, offset + 0x14, upper_32_bits(pci_addr));
}
-static void xgene_pcie_setup_cfg_reg(struct xgene_pcie *port)
+static void xgene_pcie_setup_cfg_reg(struct xgene_pcie *pcie)
{
- u64 addr = port->cfg_addr;
+ u64 addr = pcie->cfg_addr;
- xgene_pcie_writel(port, CFGBARL, lower_32_bits(addr));
- xgene_pcie_writel(port, CFGBARH, upper_32_bits(addr));
- xgene_pcie_writel(port, CFGCTL, EN_REG);
+ xgene_pcie_writel(pcie, CFGBARL, lower_32_bits(addr));
+ xgene_pcie_writel(pcie, CFGBARH, upper_32_bits(addr));
+ xgene_pcie_writel(pcie, CFGCTL, EN_REG);
}
-static int xgene_pcie_map_ranges(struct xgene_pcie *port)
+static int xgene_pcie_map_ranges(struct xgene_pcie *pcie)
{
- struct pci_host_bridge *bridge = pci_host_bridge_from_priv(port);
+ struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
struct resource_entry *window;
- struct device *dev = port->dev;
+ struct device *dev = &pcie->pdev->dev;
resource_list_for_each_entry(window, &bridge->windows) {
struct resource *res = window->res;
@@ -417,18 +417,18 @@ static int xgene_pcie_map_ranges(struct xgene_pcie *port)
switch (restype) {
case IORESOURCE_IO:
- xgene_pcie_setup_ob_reg(port, res, OMR3BARL,
+ xgene_pcie_setup_ob_reg(pcie, res, OMR3BARL,
pci_pio_to_address(res->start),
res->start - window->offset);
break;
case IORESOURCE_MEM:
if (res->flags & IORESOURCE_PREFETCH)
- xgene_pcie_setup_ob_reg(port, res, OMR2BARL,
+ xgene_pcie_setup_ob_reg(pcie, res, OMR2BARL,
res->start,
res->start -
window->offset);
else
- xgene_pcie_setup_ob_reg(port, res, OMR1BARL,
+ xgene_pcie_setup_ob_reg(pcie, res, OMR1BARL,
res->start,
res->start -
window->offset);
@@ -440,18 +440,18 @@ static int xgene_pcie_map_ranges(struct xgene_pcie *port)
return -EINVAL;
}
}
- xgene_pcie_setup_cfg_reg(port);
+ xgene_pcie_setup_cfg_reg(pcie);
return 0;
}
-static void xgene_pcie_setup_pims(struct xgene_pcie *port, u32 pim_reg,
+static void xgene_pcie_setup_pims(struct xgene_pcie *pcie, u32 pim_reg,
u64 pim, u64 size)
{
- xgene_pcie_writel(port, pim_reg, lower_32_bits(pim));
- xgene_pcie_writel(port, pim_reg + 0x04,
+ xgene_pcie_writel(pcie, pim_reg, lower_32_bits(pim));
+ xgene_pcie_writel(pcie, pim_reg + 0x04,
upper_32_bits(pim) | EN_COHERENCY);
- xgene_pcie_writel(port, pim_reg + 0x10, lower_32_bits(size));
- xgene_pcie_writel(port, pim_reg + 0x14, upper_32_bits(size));
+ xgene_pcie_writel(pcie, pim_reg + 0x10, lower_32_bits(size));
+ xgene_pcie_writel(pcie, pim_reg + 0x14, upper_32_bits(size));
}
/*
@@ -478,12 +478,12 @@ static int xgene_pcie_select_ib_reg(u8 *ib_reg_mask, u64 size)
return -EINVAL;
}
-static void xgene_pcie_setup_ib_reg(struct xgene_pcie *port,
+static void xgene_pcie_setup_ib_reg(struct xgene_pcie *pcie,
struct resource_entry *entry,
u8 *ib_reg_mask)
{
- void __iomem *cfg_base = port->cfg_base;
- struct device *dev = port->dev;
+ void __iomem *cfg_base = pcie->cfg_base;
+ struct device *dev = &pcie->pdev->dev;
void __iomem *bar_addr;
u32 pim_reg;
u64 cpu_addr = entry->res->start;
@@ -506,72 +506,72 @@ static void xgene_pcie_setup_ib_reg(struct xgene_pcie *port,
bar_low = pcie_bar_low_val((u32)cpu_addr, flags);
switch (region) {
case 0:
- xgene_pcie_set_ib_mask(port, BRIDGE_CFG_4, flags, size);
+ xgene_pcie_set_ib_mask(pcie, BRIDGE_CFG_4, flags, size);
bar_addr = cfg_base + PCI_BASE_ADDRESS_0;
writel(bar_low, bar_addr);
writel(upper_32_bits(cpu_addr), bar_addr + 0x4);
pim_reg = PIM1_1L;
break;
case 1:
- xgene_pcie_writel(port, IBAR2, bar_low);
- xgene_pcie_writel(port, IR2MSK, lower_32_bits(mask));
+ xgene_pcie_writel(pcie, IBAR2, bar_low);
+ xgene_pcie_writel(pcie, IR2MSK, lower_32_bits(mask));
pim_reg = PIM2_1L;
break;
case 2:
- xgene_pcie_writel(port, IBAR3L, bar_low);
- xgene_pcie_writel(port, IBAR3L + 0x4, upper_32_bits(cpu_addr));
- xgene_pcie_writel(port, IR3MSKL, lower_32_bits(mask));
- xgene_pcie_writel(port, IR3MSKL + 0x4, upper_32_bits(mask));
+ xgene_pcie_writel(pcie, IBAR3L, bar_low);
+ xgene_pcie_writel(pcie, IBAR3L + 0x4, upper_32_bits(cpu_addr));
+ xgene_pcie_writel(pcie, IR3MSKL, lower_32_bits(mask));
+ xgene_pcie_writel(pcie, IR3MSKL + 0x4, upper_32_bits(mask));
pim_reg = PIM3_1L;
break;
}
- xgene_pcie_setup_pims(port, pim_reg, pci_addr, ~(size - 1));
+ xgene_pcie_setup_pims(pcie, pim_reg, pci_addr, ~(size - 1));
}
-static int xgene_pcie_parse_map_dma_ranges(struct xgene_pcie *port)
+static int xgene_pcie_parse_map_dma_ranges(struct xgene_pcie *pcie)
{
- struct pci_host_bridge *bridge = pci_host_bridge_from_priv(port);
+ struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
struct resource_entry *entry;
u8 ib_reg_mask = 0;
resource_list_for_each_entry(entry, &bridge->dma_ranges)
- xgene_pcie_setup_ib_reg(port, entry, &ib_reg_mask);
+ xgene_pcie_setup_ib_reg(pcie, entry, &ib_reg_mask);
return 0;
}
/* clear BAR configuration which was done by firmware */
-static void xgene_pcie_clear_config(struct xgene_pcie *port)
+static void xgene_pcie_clear_config(struct xgene_pcie *pcie)
{
int i;
for (i = PIM1_1L; i <= CFGCTL; i += 4)
- xgene_pcie_writel(port, i, 0);
+ xgene_pcie_writel(pcie, i, 0);
}
-static int xgene_pcie_setup(struct xgene_pcie *port)
+static int xgene_pcie_setup(struct xgene_pcie *pcie)
{
- struct device *dev = port->dev;
+ struct device *dev = &pcie->pdev->dev;
u32 val, lanes = 0, speed = 0;
int ret;
- xgene_pcie_clear_config(port);
+ xgene_pcie_clear_config(pcie);
/* setup the vendor and device IDs correctly */
val = (XGENE_PCIE_DEVICEID << 16) | PCI_VENDOR_ID_AMCC;
- xgene_pcie_writel(port, BRIDGE_CFG_0, val);
+ xgene_pcie_writel(pcie, BRIDGE_CFG_0, val);
- ret = xgene_pcie_map_ranges(port);
+ ret = xgene_pcie_map_ranges(pcie);
if (ret)
return ret;
- ret = xgene_pcie_parse_map_dma_ranges(port);
+ ret = xgene_pcie_parse_map_dma_ranges(pcie);
if (ret)
return ret;
- xgene_pcie_linkup(port, &lanes, &speed);
- if (!port->link_up)
+ xgene_pcie_linkup(pcie, &lanes, &speed);
+ if (!pcie->link_up)
dev_info(dev, "(rc) link down\n");
else
dev_info(dev, "(rc) x%d gen-%d link up\n", lanes, speed + 1);
@@ -588,36 +588,36 @@ static int xgene_pcie_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *dn = dev->of_node;
- struct xgene_pcie *port;
+ struct xgene_pcie *pcie;
struct pci_host_bridge *bridge;
int ret;
- bridge = devm_pci_alloc_host_bridge(dev, sizeof(*port));
+ bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
if (!bridge)
return -ENOMEM;
- port = pci_host_bridge_priv(bridge);
+ pcie = pci_host_bridge_priv(bridge);
- port->node = of_node_get(dn);
- port->dev = dev;
+ pcie->node = of_node_get(dn);
+ pcie->pdev = pdev;
- port->version = XGENE_PCIE_IP_VER_UNKN;
- if (of_device_is_compatible(port->node, "apm,xgene-pcie"))
- port->version = XGENE_PCIE_IP_VER_1;
+ pcie->version = XGENE_PCIE_IP_VER_UNKN;
+ if (of_device_is_compatible(pcie->node, "apm,xgene-pcie"))
+ pcie->version = XGENE_PCIE_IP_VER_1;
- ret = xgene_pcie_map_reg(port, pdev);
+ ret = xgene_pcie_map_reg(pcie, pdev);
if (ret)
return ret;
- ret = xgene_pcie_init_port(port);
+ ret = xgene_pcie_init_port(pcie);
if (ret)
return ret;
- ret = xgene_pcie_setup(port);
+ ret = xgene_pcie_setup(pcie);
if (ret)
return ret;
- bridge->sysdata = port;
+ bridge->sysdata = pcie;
bridge->ops = &xgene_pcie_ops;
return pci_host_probe(bridge);
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 05/13] PCI: microchip: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
` (3 preceding siblings ...)
2021-11-27 14:11 ` [PATCH 04/13] PCI: xegene: " Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-11-27 14:11 ` [PATCH 06/13] PCI: brcmstb: " Fan Fei
` (8 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct mc_port, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pcie-microchip-host.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/controller/pcie-microchip-host.c
index 329f930d17aa..34616546e862 100644
--- a/drivers/pci/controller/pcie-microchip-host.c
+++ b/drivers/pci/controller/pcie-microchip-host.c
@@ -263,8 +263,8 @@ struct mc_msi {
};
struct mc_port {
+ struct platform_device *pdev;
void __iomem *axi_base_addr;
- struct device *dev;
struct irq_domain *intx_domain;
struct irq_domain *event_domain;
raw_spinlock_t lock;
@@ -406,7 +406,7 @@ static void mc_pcie_enable_msi(struct mc_port *port, void __iomem *base)
static void mc_handle_msi(struct irq_desc *desc)
{
struct mc_port *port = irq_desc_get_handler_data(desc);
- struct device *dev = port->dev;
+ struct device *dev = &port->pdev->dev;
struct mc_msi *msi = &port->msi;
void __iomem *bridge_base_addr =
port->axi_base_addr + MC_PCIE_BRIDGE_ADDR;
@@ -450,7 +450,7 @@ static void mc_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
msg->address_hi = upper_32_bits(addr);
msg->data = data->hwirq;
- dev_dbg(port->dev, "msi#%x address_hi %#x address_lo %#x\n",
+ dev_dbg(&port->pdev->dev, "msi#%x address_hi %#x address_lo %#x\n",
(int)data->hwirq, msg->address_hi, msg->address_lo);
}
@@ -511,7 +511,7 @@ static void mc_irq_msi_domain_free(struct irq_domain *domain, unsigned int virq,
if (test_bit(d->hwirq, msi->used))
__clear_bit(d->hwirq, msi->used);
else
- dev_err(port->dev, "trying to free unused MSI%lu\n", d->hwirq);
+ dev_err(&port->pdev->dev, "trying to free unused MSI%lu\n", d->hwirq);
mutex_unlock(&msi->lock);
}
@@ -536,7 +536,7 @@ static struct msi_domain_info mc_msi_domain_info = {
static int mc_allocate_msi_domains(struct mc_port *port)
{
- struct device *dev = port->dev;
+ struct device *dev = &port->pdev->dev;
struct fwnode_handle *fwnode = of_node_to_fwnode(dev->of_node);
struct mc_msi *msi = &port->msi;
@@ -563,7 +563,7 @@ static int mc_allocate_msi_domains(struct mc_port *port)
static void mc_handle_intx(struct irq_desc *desc)
{
struct mc_port *port = irq_desc_get_handler_data(desc);
- struct device *dev = port->dev;
+ struct device *dev = &port->pdev->dev;
void __iomem *bridge_base_addr =
port->axi_base_addr + MC_PCIE_BRIDGE_ADDR;
unsigned long status;
@@ -716,7 +716,7 @@ static u32 get_events(struct mc_port *port)
static irqreturn_t mc_event_handler(int irq, void *dev_id)
{
struct mc_port *port = dev_id;
- struct device *dev = port->dev;
+ struct device *dev = &port->pdev->dev;
struct irq_data *data;
data = irq_domain_get_irq_data(port->event_domain, irq);
@@ -883,7 +883,7 @@ static int mc_pcie_init_clks(struct device *dev)
static int mc_pcie_init_irq_domains(struct mc_port *port)
{
- struct device *dev = port->dev;
+ struct device *dev = &port->pdev->dev;
struct device_node *node = dev->of_node;
struct device_node *pcie_intc_node;
@@ -995,7 +995,7 @@ static int mc_platform_init(struct pci_config_window *cfg)
port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
if (!port)
return -ENOMEM;
- port->dev = dev;
+ port->pdev = pdev;
ret = mc_pcie_init_clks(dev);
if (ret) {
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 06/13] PCI: brcmstb: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
` (4 preceding siblings ...)
2021-11-27 14:11 ` [PATCH 05/13] PCI: microchip: " Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-11-27 14:11 ` [PATCH 07/13] PCI: mediatek-gen3: " Fan Fei
` (7 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct brcmstb_pcie, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pcie-brcmstb.c | 35 ++++++++++++++-------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 1fc7bd49a7ad..e6f0c3e561b6 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -278,7 +278,7 @@ struct brcm_msi {
/* Internal PCIe Host Controller Information.*/
struct brcm_pcie {
- struct device *dev;
+ struct platform_device *pdev;
void __iomem *base;
struct clk *clk;
struct device_node *np;
@@ -641,7 +641,7 @@ static int brcm_pcie_enable_msi(struct brcm_pcie *pcie)
{
struct brcm_msi *msi;
int irq, ret;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
irq = irq_of_parse_and_map(dev->of_node, 1);
if (irq <= 0) {
@@ -780,7 +780,7 @@ static inline int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie,
{
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
struct resource_entry *entry;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
u64 lowest_pcie_addr = ~(u64)0;
int ret, i = 0;
u64 size = 0;
@@ -866,7 +866,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
u64 rc_bar2_offset, rc_bar2_size;
void __iomem *base = pcie->base;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct resource_entry *entry;
bool ssc_good = false;
struct resource *res;
@@ -984,7 +984,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
continue;
if (num_out_wins >= BRCM_NUM_PCIE_OUT_WINS) {
- dev_err(pcie->dev, "too many outbound wins\n");
+ dev_err(dev, "too many outbound wins\n");
return -EINVAL;
}
@@ -1067,7 +1067,7 @@ static void brcm_pcie_enter_l23(struct brcm_pcie *pcie)
}
if (!l23)
- dev_err(pcie->dev, "failed to enter low-power link state\n");
+ dev_err(&pcie->pdev->dev, "failed to enter low-power link state\n");
}
static int brcm_phy_cntl(struct brcm_pcie *pcie, const int start)
@@ -1101,7 +1101,7 @@ static int brcm_phy_cntl(struct brcm_pcie *pcie, const int start)
ret = (tmp & combined_mask) == val ? 0 : -EIO;
if (ret)
- dev_err(pcie->dev, "failed to %s phy\n", (start ? "start" : "stop"));
+ dev_err(&pcie->pdev->dev, "failed to %s phy\n", (start ? "start" : "stop"));
return ret;
}
@@ -1231,24 +1231,25 @@ static const struct of_device_id brcm_pcie_match[] = {
static int brcm_pcie_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct device_node *np = pdev->dev.of_node, *msi_np;
struct pci_host_bridge *bridge;
const struct pcie_cfg_data *data;
struct brcm_pcie *pcie;
int ret;
- bridge = devm_pci_alloc_host_bridge(&pdev->dev, sizeof(*pcie));
+ bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
if (!bridge)
return -ENOMEM;
- data = of_device_get_match_data(&pdev->dev);
+ data = of_device_get_match_data(dev);
if (!data) {
pr_err("failed to look up compatible string\n");
return -EINVAL;
}
pcie = pci_host_bridge_priv(bridge);
- pcie->dev = &pdev->dev;
+ pcie->pdev = pdev;
pcie->np = np;
pcie->reg_offsets = data->offsets;
pcie->type = data->type;
@@ -1259,7 +1260,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
if (IS_ERR(pcie->base))
return PTR_ERR(pcie->base);
- pcie->clk = devm_clk_get_optional(&pdev->dev, "sw_pcie");
+ pcie->clk = devm_clk_get_optional(dev, "sw_pcie");
if (IS_ERR(pcie->clk))
return PTR_ERR(pcie->clk);
@@ -1270,15 +1271,15 @@ static int brcm_pcie_probe(struct platform_device *pdev)
ret = clk_prepare_enable(pcie->clk);
if (ret) {
- dev_err(&pdev->dev, "could not enable clock\n");
+ dev_err(dev, "could not enable clock\n");
return ret;
}
- pcie->rescal = devm_reset_control_get_optional_shared(&pdev->dev, "rescal");
+ pcie->rescal = devm_reset_control_get_optional_shared(dev, "rescal");
if (IS_ERR(pcie->rescal)) {
clk_disable_unprepare(pcie->clk);
return PTR_ERR(pcie->rescal);
}
- pcie->perst_reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "perst");
+ pcie->perst_reset = devm_reset_control_get_optional_exclusive(dev, "perst");
if (IS_ERR(pcie->perst_reset)) {
clk_disable_unprepare(pcie->clk);
return PTR_ERR(pcie->perst_reset);
@@ -1286,7 +1287,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
ret = reset_control_reset(pcie->rescal);
if (ret)
- dev_err(&pdev->dev, "failed to deassert 'rescal'\n");
+ dev_err(dev, "failed to deassert 'rescal'\n");
ret = brcm_phy_start(pcie);
if (ret) {
@@ -1301,7 +1302,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
pcie->hw_rev = readl(pcie->base + PCIE_MISC_REVISION);
if (pcie->type == BCM4908 && pcie->hw_rev >= BRCM_PCIE_HW_REV_3_20) {
- dev_err(pcie->dev, "hardware revision with unsupported PERST# setup\n");
+ dev_err(dev, "hardware revision with unsupported PERST# setup\n");
ret = -ENODEV;
goto fail;
}
@@ -1310,7 +1311,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
if (pci_msi_enabled() && msi_np == pcie->np) {
ret = brcm_pcie_enable_msi(pcie);
if (ret) {
- dev_err(pcie->dev, "probe of internal MSI failed");
+ dev_err(dev, "probe of internal MSI failed");
goto fail;
}
}
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 07/13] PCI: mediatek-gen3: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
` (5 preceding siblings ...)
2021-11-27 14:11 ` [PATCH 06/13] PCI: brcmstb: " Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-11-27 14:11 ` [PATCH 08/13] PCI: rcar-gen2: " Fan Fei
` (6 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct mtk_pcie, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pcie-mediatek-gen3.c | 36 ++++++++++++---------
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c
index 459fe88297b0..6e347be00b0d 100644
--- a/drivers/pci/controller/pcie-mediatek-gen3.c
+++ b/drivers/pci/controller/pcie-mediatek-gen3.c
@@ -130,7 +130,7 @@ struct mtk_msi_set {
* @msi_irq_in_use: bit map for assigned MSI IRQ
*/
struct mtk_gen3_pcie {
- struct device *dev;
+ struct platform_device *pdev;
void __iomem *base;
phys_addr_t reg_base;
struct reset_control *mac_reset;
@@ -213,11 +213,12 @@ static int mtk_pcie_set_trans_table(struct mtk_gen3_pcie *pcie,
resource_size_t size,
unsigned long type, int num)
{
+ struct device *dev = &pcie->pdev->dev;
void __iomem *table;
u32 val;
if (num >= PCIE_MAX_TRANS_TABLES) {
- dev_err(pcie->dev, "not enough translate table for addr: %#llx, limited to [%d]\n",
+ dev_err(dev, "not enough translate table for addr: %#llx, limited to [%d]\n",
(unsigned long long)cpu_addr, PCIE_MAX_TRANS_TABLES);
return -ENODEV;
}
@@ -275,6 +276,7 @@ static void mtk_pcie_enable_msi(struct mtk_gen3_pcie *pcie)
static int mtk_pcie_startup_port(struct mtk_gen3_pcie *pcie)
{
+ struct device *dev = &pcie->pdev->dev;
struct resource_entry *entry;
struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
unsigned int table_index = 0;
@@ -320,7 +322,7 @@ static int mtk_pcie_startup_port(struct mtk_gen3_pcie *pcie)
PCI_PM_D3COLD_WAIT * USEC_PER_MSEC);
if (err) {
val = readl_relaxed(pcie->base + PCIE_LTSSM_STATUS_REG);
- dev_err(pcie->dev, "PCIe link down, ltssm reg val: %#x\n", val);
+ dev_err(dev, "PCIe link down, ltssm reg val: %#x\n", val);
return err;
}
@@ -352,7 +354,7 @@ static int mtk_pcie_startup_port(struct mtk_gen3_pcie *pcie)
if (err)
return err;
- dev_dbg(pcie->dev, "set %s trans window[%d]: cpu_addr = %#llx, pci_addr = %#llx, size = %#llx\n",
+ dev_dbg(dev, "set %s trans window[%d]: cpu_addr = %#llx, pci_addr = %#llx, size = %#llx\n",
range_type, table_index, (unsigned long long)cpu_addr,
(unsigned long long)pci_addr, (unsigned long long)size);
@@ -397,6 +399,7 @@ static void mtk_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
{
struct mtk_msi_set *msi_set = irq_data_get_irq_chip_data(data);
struct mtk_gen3_pcie *pcie = data->domain->host_data;
+ struct device *dev = &pcie->pdev->dev;
unsigned long hwirq;
hwirq = data->hwirq % PCIE_MSI_IRQS_PER_SET;
@@ -404,7 +407,7 @@ static void mtk_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
msg->address_hi = upper_32_bits(msi_set->msg_addr);
msg->address_lo = lower_32_bits(msi_set->msg_addr);
msg->data = hwirq;
- dev_dbg(pcie->dev, "msi#%#lx address_hi %#x address_lo %#x data %d\n",
+ dev_dbg(dev, "msi#%#lx address_hi %#x address_lo %#x data %d\n",
hwirq, msg->address_hi, msg->address_lo, msg->data);
}
@@ -575,7 +578,7 @@ static const struct irq_domain_ops intx_domain_ops = {
static int mtk_pcie_init_irq_domains(struct mtk_gen3_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct device_node *intc_node, *node = dev->of_node;
int ret;
@@ -691,8 +694,8 @@ static void mtk_pcie_irq_handler(struct irq_desc *desc)
static int mtk_pcie_setup_irq(struct mtk_gen3_pcie *pcie)
{
- struct device *dev = pcie->dev;
- struct platform_device *pdev = to_platform_device(dev);
+ struct platform_device *pdev = pcie->pdev;
+ struct device *dev = &pdev->dev;
int err;
err = mtk_pcie_init_irq_domains(pcie);
@@ -710,8 +713,8 @@ static int mtk_pcie_setup_irq(struct mtk_gen3_pcie *pcie)
static int mtk_pcie_parse_port(struct mtk_gen3_pcie *pcie)
{
- struct device *dev = pcie->dev;
- struct platform_device *pdev = to_platform_device(dev);
+ struct platform_device *pdev = pcie->pdev;
+ struct device *dev = &pdev->dev;
struct resource *regs;
int ret;
@@ -764,7 +767,7 @@ static int mtk_pcie_parse_port(struct mtk_gen3_pcie *pcie)
static int mtk_pcie_power_up(struct mtk_gen3_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
int err;
/* PHY power on and enable pipe clock */
@@ -811,10 +814,11 @@ static int mtk_pcie_power_up(struct mtk_gen3_pcie *pcie)
static void mtk_pcie_power_down(struct mtk_gen3_pcie *pcie)
{
+ struct device *dev = &pcie->pdev->dev;
clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks);
- pm_runtime_put_sync(pcie->dev);
- pm_runtime_disable(pcie->dev);
+ pm_runtime_put_sync(dev);
+ pm_runtime_disable(dev);
reset_control_assert(pcie->mac_reset);
phy_power_off(pcie->phy);
@@ -865,7 +869,7 @@ static int mtk_pcie_probe(struct platform_device *pdev)
pcie = pci_host_bridge_priv(host);
- pcie->dev = dev;
+ pcie->pdev = pdev;
platform_set_drvdata(pdev, pcie);
err = mtk_pcie_setup(pcie);
@@ -961,7 +965,7 @@ static int __maybe_unused mtk_pcie_suspend_noirq(struct device *dev)
/* Trigger link to L2 state */
err = mtk_pcie_turn_off_link(pcie);
if (err) {
- dev_err(pcie->dev, "cannot enter L2 state\n");
+ dev_err(dev, "cannot enter L2 state\n");
return err;
}
@@ -970,7 +974,7 @@ static int __maybe_unused mtk_pcie_suspend_noirq(struct device *dev)
val |= PCIE_PE_RSTB;
writel_relaxed(val, pcie->base + PCIE_RST_CTRL_REG);
- dev_dbg(pcie->dev, "entered L2 states successfully");
+ dev_dbg(dev, "entered L2 states successfully");
mtk_pcie_irq_save(pcie);
mtk_pcie_power_down(pcie);
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 08/13] PCI: rcar-gen2: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
` (6 preceding siblings ...)
2021-11-27 14:11 ` [PATCH 07/13] PCI: mediatek-gen3: " Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-11-27 14:11 ` [PATCH 09/13] PCI: ftpci100: " Fan Fei
` (5 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct rcar_pci_priv, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pci-rcar-gen2.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/controller/pci-rcar-gen2.c b/drivers/pci/controller/pci-rcar-gen2.c
index afde4aa8f6dc..be24b08dfbaa 100644
--- a/drivers/pci/controller/pci-rcar-gen2.c
+++ b/drivers/pci/controller/pci-rcar-gen2.c
@@ -94,7 +94,7 @@
#define RCAR_PCI_UNIT_REV_REG (RCAR_AHBPCI_PCICOM_OFFSET + 0x48)
struct rcar_pci_priv {
- struct device *dev;
+ struct platform_device *pdev;
void __iomem *reg;
struct resource mem_res;
struct resource *cfg_res;
@@ -133,7 +133,7 @@ static void __iomem *rcar_pci_cfg_base(struct pci_bus *bus, unsigned int devfn,
static irqreturn_t rcar_pci_err_irq(int irq, void *pw)
{
struct rcar_pci_priv *priv = pw;
- struct device *dev = priv->dev;
+ struct device *dev = &priv->pdev->dev;
u32 status = ioread32(priv->reg + RCAR_PCI_INT_STATUS_REG);
if (status & RCAR_PCI_INT_ALLERRORS) {
@@ -150,7 +150,7 @@ static irqreturn_t rcar_pci_err_irq(int irq, void *pw)
static void rcar_pci_setup_errirq(struct rcar_pci_priv *priv)
{
- struct device *dev = priv->dev;
+ struct device *dev = &priv->pdev->dev;
int ret;
u32 val;
@@ -173,7 +173,7 @@ static inline void rcar_pci_setup_errirq(struct rcar_pci_priv *priv) { }
static void rcar_pci_setup(struct rcar_pci_priv *priv)
{
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(priv);
- struct device *dev = priv->dev;
+ struct device *dev = &priv->pdev->dev;
void __iomem *reg = priv->reg;
struct resource_entry *entry;
unsigned long window_size;
@@ -307,7 +307,7 @@ static int rcar_pci_probe(struct platform_device *pdev)
priv->irq = platform_get_irq(pdev, 0);
priv->reg = reg;
- priv->dev = dev;
+ priv->pdev = pdev;
if (priv->irq < 0) {
dev_err(dev, "no valid irq found\n");
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 09/13] PCI: ftpci100: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
` (7 preceding siblings ...)
2021-11-27 14:11 ` [PATCH 08/13] PCI: rcar-gen2: " Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-11-27 14:11 ` [PATCH 10/13] PCI: v3-semi: " Fan Fei
` (4 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct faraday_pci, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pci-ftpci100.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/pci/controller/pci-ftpci100.c b/drivers/pci/controller/pci-ftpci100.c
index 88980a44461d..64e4405ad0be 100644
--- a/drivers/pci/controller/pci-ftpci100.c
+++ b/drivers/pci/controller/pci-ftpci100.c
@@ -120,7 +120,7 @@ struct faraday_pci_variant {
};
struct faraday_pci {
- struct device *dev;
+ struct platform_device *pdev;
void __iomem *base;
struct irq_domain *irqdomain;
struct pci_bus *bus;
@@ -342,19 +342,20 @@ static const struct irq_domain_ops faraday_pci_irqdomain_ops = {
static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p)
{
- struct device_node *intc = of_get_next_child(p->dev->of_node, NULL);
+ struct device *dev = &p->pdev->dev;
+ struct device_node *intc = of_get_next_child(dev->of_node, NULL);
int irq;
int i;
if (!intc) {
- dev_err(p->dev, "missing child interrupt-controller node\n");
+ dev_err(dev, "missing child interrupt-controller node\n");
return -EINVAL;
}
/* All PCI IRQs cascade off this one */
irq = of_irq_get(intc, 0);
if (irq <= 0) {
- dev_err(p->dev, "failed to get parent IRQ\n");
+ dev_err(dev, "failed to get parent IRQ\n");
of_node_put(intc);
return irq ?: -EINVAL;
}
@@ -363,7 +364,7 @@ static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p)
&faraday_pci_irqdomain_ops, p);
of_node_put(intc);
if (!p->irqdomain) {
- dev_err(p->dev, "failed to create Gemini PCI IRQ domain\n");
+ dev_err(dev, "failed to create Gemini PCI IRQ domain\n");
return -EINVAL;
}
@@ -377,7 +378,7 @@ static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p)
static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p)
{
- struct device *dev = p->dev;
+ struct device *dev = &p->pdev->dev;
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(p);
struct resource_entry *entry;
u32 confreg[3] = {
@@ -439,7 +440,7 @@ static int faraday_pci_probe(struct platform_device *pdev)
host->ops = &faraday_pci_ops;
p = pci_host_bridge_priv(host);
host->sysdata = p;
- p->dev = dev;
+ p->pdev = pdev;
/* Retrieve and enable optional clocks */
clk = devm_clk_get(dev, "PCLK");
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 10/13] PCI: v3-semi: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
` (8 preceding siblings ...)
2021-11-27 14:11 ` [PATCH 09/13] PCI: ftpci100: " Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-11-27 14:11 ` [PATCH 11/13] PCI: ixp4xx: " Fan Fei
` (3 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct v3_pci, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pci-v3-semi.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/controller/pci-v3-semi.c b/drivers/pci/controller/pci-v3-semi.c
index 154a5398633c..96b486650667 100644
--- a/drivers/pci/controller/pci-v3-semi.c
+++ b/drivers/pci/controller/pci-v3-semi.c
@@ -236,7 +236,7 @@
#define INTEGRATOR_SC_LBFCODE_OFFSET 0x24
struct v3_pci {
- struct device *dev;
+ struct platform_device *pdev;
void __iomem *base;
void __iomem *config_base;
u32 config_mem;
@@ -438,7 +438,7 @@ static struct pci_ops v3_pci_ops = {
static irqreturn_t v3_irq(int irq, void *data)
{
struct v3_pci *v3 = data;
- struct device *dev = v3->dev;
+ struct device *dev = &v3->pdev->dev;
u32 status;
status = readw(v3->base + V3_PCI_STAT);
@@ -481,12 +481,13 @@ static irqreturn_t v3_irq(int irq, void *data)
static int v3_integrator_init(struct v3_pci *v3)
{
+ struct device *dev = &v3->pdev->dev;
unsigned int val;
v3->map =
syscon_regmap_lookup_by_compatible("arm,integrator-ap-syscon");
if (IS_ERR(v3->map)) {
- dev_err(v3->dev, "no syscon\n");
+ dev_err(dev, "no syscon\n");
return -ENODEV;
}
@@ -511,7 +512,7 @@ static int v3_integrator_init(struct v3_pci *v3)
readb(v3->base + V3_MAIL_DATA) != 0x55);
}
- dev_info(v3->dev, "initialized PCI V3 Integrator/AP integration\n");
+ dev_info(dev, "initialized PCI V3 Integrator/AP integration\n");
return 0;
}
@@ -520,7 +521,7 @@ static int v3_pci_setup_resource(struct v3_pci *v3,
struct pci_host_bridge *host,
struct resource_entry *win)
{
- struct device *dev = v3->dev;
+ struct device *dev = &v3->pdev->dev;
struct resource *mem;
struct resource *io;
@@ -598,7 +599,7 @@ static int v3_get_dma_range_config(struct v3_pci *v3,
struct resource_entry *entry,
u32 *pci_base, u32 *pci_map)
{
- struct device *dev = v3->dev;
+ struct device *dev = &v3->pdev->dev;
u64 cpu_addr = entry->res->start;
u64 cpu_end = entry->res->end;
u64 pci_end = cpu_end - entry->offset;
@@ -656,7 +657,7 @@ static int v3_get_dma_range_config(struct v3_pci *v3,
val |= V3_LB_BASE_ADR_SIZE_2GB;
break;
default:
- dev_err(v3->dev, "illegal dma memory chunk size\n");
+ dev_err(dev, "illegal dma memory chunk size\n");
return -EINVAL;
}
val |= V3_PCI_MAP_M_REG_EN | V3_PCI_MAP_M_ENABLE;
@@ -676,7 +677,7 @@ static int v3_pci_parse_map_dma_ranges(struct v3_pci *v3,
struct device_node *np)
{
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(v3);
- struct device *dev = v3->dev;
+ struct device *dev = &v3->pdev->dev;
struct resource_entry *entry;
int i = 0;
@@ -723,7 +724,7 @@ static int v3_pci_probe(struct platform_device *pdev)
host->ops = &v3_pci_ops;
v3 = pci_host_bridge_priv(host);
host->sysdata = v3;
- v3->dev = dev;
+ v3->pdev = pdev;
/* Get and enable host clock */
clk = devm_clk_get(dev, NULL);
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 11/13] PCI: ixp4xx: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
` (9 preceding siblings ...)
2021-11-27 14:11 ` [PATCH 10/13] PCI: v3-semi: " Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-11-27 14:11 ` [PATCH 12/13] PCI: xilinx-nwl: " Fan Fei
` (2 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct ixp4xx_pci, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pci-ixp4xx.c | 47 ++++++++++++++++-------------
1 file changed, 26 insertions(+), 21 deletions(-)
diff --git a/drivers/pci/controller/pci-ixp4xx.c b/drivers/pci/controller/pci-ixp4xx.c
index 654ac4a82beb..13e8a4754f5b 100644
--- a/drivers/pci/controller/pci-ixp4xx.c
+++ b/drivers/pci/controller/pci-ixp4xx.c
@@ -101,7 +101,7 @@
#define IXP4XX_PCI_RTOTTO 0x40
struct ixp4xx_pci {
- struct device *dev;
+ struct platform_device *pdev;
void __iomem *base;
bool errata_hammer;
bool host_mode;
@@ -138,7 +138,7 @@ static int ixp4xx_pci_check_master_abort(struct ixp4xx_pci *p)
if (isr & IXP4XX_PCI_ISR_PFE) {
/* Make sure the master abort bit is reset */
ixp4xx_writel(p, IXP4XX_PCI_ISR, IXP4XX_PCI_ISR_PFE);
- dev_dbg(p->dev, "master abort detected\n");
+ dev_dbg(&p->pdev->dev, "master abort detected\n");
return -EINVAL;
}
@@ -216,12 +216,13 @@ static u32 ixp4xx_crp_byte_lane_enable_bits(u32 n, int size)
static int ixp4xx_crp_read_config(struct ixp4xx_pci *p, int where, int size,
u32 *value)
{
+ struct device *dev = &p->pdev->dev;
u32 n, cmd, val;
n = where % 4;
cmd = where & ~3;
- dev_dbg(p->dev, "%s from %d size %d cmd %08x\n",
+ dev_dbg(dev, "%s from %d size %d cmd %08x\n",
__func__, where, size, cmd);
ixp4xx_writel(p, IXP4XX_PCI_CRP_AD_CBE, cmd);
@@ -231,19 +232,19 @@ static int ixp4xx_crp_read_config(struct ixp4xx_pci *p, int where, int size,
switch (size) {
case 1:
val &= U8_MAX;
- dev_dbg(p->dev, "%s read byte %02x\n", __func__, val);
+ dev_dbg(dev, "%s read byte %02x\n", __func__, val);
break;
case 2:
val &= U16_MAX;
- dev_dbg(p->dev, "%s read word %04x\n", __func__, val);
+ dev_dbg(dev, "%s read word %04x\n", __func__, val);
break;
case 4:
val &= U32_MAX;
- dev_dbg(p->dev, "%s read long %08x\n", __func__, val);
+ dev_dbg(dev, "%s read long %08x\n", __func__, val);
break;
default:
/* Should not happen */
- dev_err(p->dev, "%s illegal size\n", __func__);
+ dev_err(dev, "%s illegal size\n", __func__);
return PCIBIOS_DEVICE_NOT_FOUND;
}
*value = val;
@@ -254,6 +255,7 @@ static int ixp4xx_crp_read_config(struct ixp4xx_pci *p, int where, int size,
static int ixp4xx_crp_write_config(struct ixp4xx_pci *p, int where, int size,
u32 value)
{
+ struct device *dev = &p->pdev->dev;
u32 n, cmd, val;
n = where % 4;
@@ -265,7 +267,7 @@ static int ixp4xx_crp_write_config(struct ixp4xx_pci *p, int where, int size,
val = value << (8*n);
- dev_dbg(p->dev, "%s to %d size %d cmd %08x val %08x\n",
+ dev_dbg(dev, "%s to %d size %d cmd %08x val %08x\n",
__func__, where, size, cmd, val);
ixp4xx_writel(p, IXP4XX_PCI_CRP_AD_CBE, cmd);
@@ -293,6 +295,7 @@ static int ixp4xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 *value)
{
struct ixp4xx_pci *p = bus->sysdata;
+ struct device *dev = &p->pdev->dev;
u32 n, addr, val, cmd;
u8 bus_num = bus->number;
int ret;
@@ -305,7 +308,7 @@ static int ixp4xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
addr = ixp4xx_config_addr(bus_num, devfn, where);
cmd |= NP_CMD_CONFIGREAD;
- dev_dbg(p->dev, "read_config from %d size %d dev %d:%d:%d address: %08x cmd: %08x\n",
+ dev_dbg(dev, "read_config from %d size %d dev %d:%d:%d address: %08x cmd: %08x\n",
where, size, bus_num, PCI_SLOT(devfn), PCI_FUNC(devfn), addr, cmd);
ret = ixp4xx_pci_read_indirect(p, addr, cmd, &val);
@@ -316,19 +319,19 @@ static int ixp4xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
switch (size) {
case 1:
val &= U8_MAX;
- dev_dbg(p->dev, "%s read byte %02x\n", __func__, val);
+ dev_dbg(dev, "%s read byte %02x\n", __func__, val);
break;
case 2:
val &= U16_MAX;
- dev_dbg(p->dev, "%s read word %04x\n", __func__, val);
+ dev_dbg(dev, "%s read word %04x\n", __func__, val);
break;
case 4:
val &= U32_MAX;
- dev_dbg(p->dev, "%s read long %08x\n", __func__, val);
+ dev_dbg(dev, "%s read long %08x\n", __func__, val);
break;
default:
/* Should not happen */
- dev_err(p->dev, "%s illegal size\n", __func__);
+ dev_err(dev, "%s illegal size\n", __func__);
return PCIBIOS_DEVICE_NOT_FOUND;
}
*value = val;
@@ -340,6 +343,7 @@ static int ixp4xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 value)
{
struct ixp4xx_pci *p = bus->sysdata;
+ struct device *dev = &p->pdev->dev;
u32 n, addr, val, cmd;
u8 bus_num = bus->number;
int ret;
@@ -353,7 +357,7 @@ static int ixp4xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
cmd |= NP_CMD_CONFIGWRITE;
val = value << (8*n);
- dev_dbg(p->dev, "write_config_byte %#x to %d size %d dev %d:%d:%d addr: %08x cmd %08x\n",
+ dev_dbg(dev, "write_config_byte %#x to %d size %d dev %d:%d:%d addr: %08x cmd %08x\n",
value, where, size, bus_num, PCI_SLOT(devfn), PCI_FUNC(devfn), addr, cmd);
ret = ixp4xx_pci_write_indirect(p, addr, cmd, val);
@@ -379,7 +383,7 @@ static u32 ixp4xx_pci_addr_to_64mconf(phys_addr_t addr)
static int ixp4xx_pci_parse_map_ranges(struct ixp4xx_pci *p)
{
- struct device *dev = p->dev;
+ struct device *dev = &p->pdev->dev;
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(p);
struct resource_entry *win;
struct resource *res;
@@ -437,7 +441,7 @@ static int ixp4xx_pci_parse_map_ranges(struct ixp4xx_pci *p)
static int ixp4xx_pci_parse_map_dma_ranges(struct ixp4xx_pci *p)
{
- struct device *dev = p->dev;
+ struct device *dev = &p->pdev->dev;
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(p);
struct resource_entry *win;
struct resource *res;
@@ -476,17 +480,18 @@ static int ixp4xx_pci_abort_handler(unsigned long addr, unsigned int fsr,
struct pt_regs *regs)
{
struct ixp4xx_pci *p = ixp4xx_pci_abort_singleton;
+ struct device *dev = &p->pdev->dev;
u32 isr, status;
int ret;
isr = ixp4xx_readl(p, IXP4XX_PCI_ISR);
ret = ixp4xx_crp_read_config(p, PCI_STATUS, 2, &status);
if (ret) {
- dev_err(p->dev, "unable to read abort status\n");
+ dev_err(dev, "unable to read abort status\n");
return -EINVAL;
}
- dev_err(p->dev,
+ dev_err(dev,
"PCI: abort_handler addr = %#lx, isr = %#x, status = %#x\n",
addr, isr, status);
@@ -495,14 +500,14 @@ static int ixp4xx_pci_abort_handler(unsigned long addr, unsigned int fsr,
status |= PCI_STATUS_REC_MASTER_ABORT;
ret = ixp4xx_crp_write_config(p, PCI_STATUS, 2, status);
if (ret)
- dev_err(p->dev, "unable to clear abort status bit\n");
+ dev_err(dev, "unable to clear abort status bit\n");
/*
* If it was an imprecise abort, then we need to correct the
* return address to be _after_ the instruction.
*/
if (fsr & (1 << 10)) {
- dev_err(p->dev, "imprecise abort\n");
+ dev_err(dev, "imprecise abort\n");
regs->ARM_pc += 4;
}
@@ -533,7 +538,7 @@ static int __init ixp4xx_pci_probe(struct platform_device *pdev)
host->ops = &ixp4xx_pci_ops;
p = pci_host_bridge_priv(host);
host->sysdata = p;
- p->dev = dev;
+ p->pdev = pdev;
dev_set_drvdata(dev, p);
/*
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 12/13] PCI: xilinx-nwl: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
` (10 preceding siblings ...)
2021-11-27 14:11 ` [PATCH 11/13] PCI: ixp4xx: " Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-11-27 14:11 ` [PATCH 13/13] PCI: rcar: " Fan Fei
2021-12-23 0:43 ` [PATCH 00/13] Unify device * to " Bjorn Helgaas
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct nwl_pcie, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pcie-xilinx-nwl.c | 28 ++++++++++++------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c
index a72b4f9a2b00..2e17fe41a9bd 100644
--- a/drivers/pci/controller/pcie-xilinx-nwl.c
+++ b/drivers/pci/controller/pcie-xilinx-nwl.c
@@ -154,7 +154,7 @@ struct nwl_msi { /* MSI information */
};
struct nwl_pcie {
- struct device *dev;
+ struct platform_device *pdev;
void __iomem *breg_base;
void __iomem *pcireg_base;
void __iomem *ecam_base;
@@ -200,7 +200,7 @@ static bool nwl_phy_link_up(struct nwl_pcie *pcie)
static int nwl_wait_for_link(struct nwl_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
int retries;
/* check if the link is up or not */
@@ -260,7 +260,7 @@ static struct pci_ops nwl_pcie_ops = {
static irqreturn_t nwl_pcie_misc_handler(int irq, void *data)
{
struct nwl_pcie *pcie = data;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
u32 misc_stat;
/* Checking for misc interrupts */
@@ -504,7 +504,7 @@ static const struct irq_domain_ops dev_msi_domain_ops = {
static int nwl_pcie_init_msi_irq_domain(struct nwl_pcie *pcie)
{
#ifdef CONFIG_PCI_MSI
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct fwnode_handle *fwnode = of_node_to_fwnode(dev->of_node);
struct nwl_msi *msi = &pcie->msi;
@@ -528,7 +528,7 @@ static int nwl_pcie_init_msi_irq_domain(struct nwl_pcie *pcie)
static int nwl_pcie_init_irq_domain(struct nwl_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct device_node *node = dev->of_node;
struct device_node *legacy_intc_node;
@@ -555,8 +555,8 @@ static int nwl_pcie_init_irq_domain(struct nwl_pcie *pcie)
static int nwl_pcie_enable_msi(struct nwl_pcie *pcie)
{
- struct device *dev = pcie->dev;
- struct platform_device *pdev = to_platform_device(dev);
+ struct platform_device *pdev = pcie->pdev;
+ struct device *dev = &pdev->dev;
struct nwl_msi *msi = &pcie->msi;
unsigned long base;
int ret;
@@ -640,8 +640,8 @@ static int nwl_pcie_enable_msi(struct nwl_pcie *pcie)
static int nwl_pcie_bridge_init(struct nwl_pcie *pcie)
{
- struct device *dev = pcie->dev;
- struct platform_device *pdev = to_platform_device(dev);
+ struct platform_device *pdev = pcie->pdev;
+ struct device *dev = &pdev->dev;
u32 breg_val, ecam_val, first_busno = 0;
int err;
@@ -756,10 +756,10 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie)
return 0;
}
-static int nwl_pcie_parse_dt(struct nwl_pcie *pcie,
- struct platform_device *pdev)
+static int nwl_pcie_parse_dt(struct nwl_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct platform_device *pdev = pcie->pdev;
+ struct device *dev = &pdev->dev;
struct resource *res;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "breg");
@@ -809,10 +809,10 @@ static int nwl_pcie_probe(struct platform_device *pdev)
pcie = pci_host_bridge_priv(bridge);
- pcie->dev = dev;
+ pcie->pdev = pdev;
pcie->ecam_value = NWL_ECAM_VALUE_DEFAULT;
- err = nwl_pcie_parse_dt(pcie, pdev);
+ err = nwl_pcie_parse_dt(pcie);
if (err) {
dev_err(dev, "Parsing DT failed\n");
return err;
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 13/13] PCI: rcar: Replace device * with platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
` (11 preceding siblings ...)
2021-11-27 14:11 ` [PATCH 12/13] PCI: xilinx-nwl: " Fan Fei
@ 2021-11-27 14:11 ` Fan Fei
2021-12-23 0:43 ` [PATCH 00/13] Unify device * to " Bjorn Helgaas
13 siblings, 0 replies; 17+ messages in thread
From: Fan Fei @ 2021-11-27 14:11 UTC (permalink / raw)
To: bjorn; +Cc: Fan Fei, linux-pci
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct rcar_pcie, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device. Modify rcar host
and endpoint file in this patch, because both struct include member
rcar_pcie.
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
drivers/pci/controller/pcie-rcar-ep.c | 40 ++++++++++++++-----------
drivers/pci/controller/pcie-rcar-host.c | 27 +++++++++--------
drivers/pci/controller/pcie-rcar.h | 2 +-
3 files changed, 37 insertions(+), 32 deletions(-)
diff --git a/drivers/pci/controller/pcie-rcar-ep.c b/drivers/pci/controller/pcie-rcar-ep.c
index f9682df1da61..1a471220f560 100644
--- a/drivers/pci/controller/pcie-rcar-ep.c
+++ b/drivers/pci/controller/pcie-rcar-ep.c
@@ -87,10 +87,11 @@ static int rcar_pcie_ep_get_window(struct rcar_pcie_endpoint *ep,
return -EINVAL;
}
-static int rcar_pcie_parse_outbound_ranges(struct rcar_pcie_endpoint *ep,
- struct platform_device *pdev)
+static int rcar_pcie_parse_outbound_ranges(struct rcar_pcie_endpoint *ep)
{
struct rcar_pcie *pcie = &ep->pcie;
+ struct platform_device *pdev = pcie->pdev;
+ struct device *dev = &pdev->dev;
char outbound_name[10];
struct resource *res;
unsigned int i = 0;
@@ -102,13 +103,13 @@ static int rcar_pcie_parse_outbound_ranges(struct rcar_pcie_endpoint *ep,
IORESOURCE_MEM,
outbound_name);
if (!res) {
- dev_err(pcie->dev, "missing outbound window %u\n", i);
+ dev_err(dev, "missing outbound window %u\n", i);
return -EINVAL;
}
- if (!devm_request_mem_region(&pdev->dev, res->start,
+ if (!devm_request_mem_region(dev, res->start,
resource_size(res),
outbound_name)) {
- dev_err(pcie->dev, "Cannot request memory region %s.\n",
+ dev_err(dev, "Cannot request memory region %s.\n",
outbound_name);
return -EIO;
}
@@ -125,12 +126,12 @@ static int rcar_pcie_parse_outbound_ranges(struct rcar_pcie_endpoint *ep,
return 0;
}
-static int rcar_pcie_ep_get_pdata(struct rcar_pcie_endpoint *ep,
- struct platform_device *pdev)
+static int rcar_pcie_ep_get_pdata(struct rcar_pcie_endpoint *ep)
{
struct rcar_pcie *pcie = &ep->pcie;
struct pci_epc_mem_window *window;
- struct device *dev = pcie->dev;
+ struct platform_device *pdev = pcie->pdev;
+ struct device *dev = &pdev->dev;
struct resource res;
int err;
@@ -146,7 +147,7 @@ static int rcar_pcie_ep_get_pdata(struct rcar_pcie_endpoint *ep,
if (!ep->ob_window)
return -ENOMEM;
- rcar_pcie_parse_outbound_ranges(ep, pdev);
+ rcar_pcie_parse_outbound_ranges(ep);
err = of_property_read_u8(dev->of_node, "max-functions",
&ep->max_functions);
@@ -201,13 +202,14 @@ static int rcar_pcie_ep_set_bar(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
dma_addr_t cpu_addr = epf_bar->phys_addr;
enum pci_barno bar = epf_bar->barno;
struct rcar_pcie *pcie = &ep->pcie;
+ struct device *dev = &pcie->pdev->dev;
u32 mask;
int idx;
int err;
idx = find_first_zero_bit(ep->ib_window_map, ep->num_ib_windows);
if (idx >= ep->num_ib_windows) {
- dev_err(pcie->dev, "no free inbound window\n");
+ dev_err(dev, "no free inbound window\n");
return -EINVAL;
}
@@ -236,7 +238,7 @@ static int rcar_pcie_ep_set_bar(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
err = rcar_pcie_wait_for_phyrdy(pcie);
if (err) {
- dev_err(pcie->dev, "phy not ready\n");
+ dev_err(dev, "phy not ready\n");
return -EINVAL;
}
@@ -288,6 +290,7 @@ static int rcar_pcie_ep_map_addr(struct pci_epc *epc, u8 fn, u8 vfn,
{
struct rcar_pcie_endpoint *ep = epc_get_drvdata(epc);
struct rcar_pcie *pcie = &ep->pcie;
+ struct device *dev = &pcie->pdev->dev;
struct resource_entry win;
struct resource res;
int window;
@@ -296,13 +299,13 @@ static int rcar_pcie_ep_map_addr(struct pci_epc *epc, u8 fn, u8 vfn,
/* check if we have a link. */
err = rcar_pcie_wait_for_dl(pcie);
if (err) {
- dev_err(pcie->dev, "link not up\n");
+ dev_err(dev, "link not up\n");
return err;
}
window = rcar_pcie_ep_get_window(ep, addr);
if (window < 0) {
- dev_err(pcie->dev, "failed to get corresponding window\n");
+ dev_err(dev, "failed to get corresponding window\n");
return -EINVAL;
}
@@ -347,23 +350,24 @@ static int rcar_pcie_ep_assert_intx(struct rcar_pcie_endpoint *ep,
u8 fn, u8 intx)
{
struct rcar_pcie *pcie = &ep->pcie;
+ struct device *dev = &pcie->pdev->dev;
u32 val;
val = rcar_pci_read_reg(pcie, PCIEMSITXR);
if ((val & PCI_MSI_FLAGS_ENABLE)) {
- dev_err(pcie->dev, "MSI is enabled, cannot assert INTx\n");
+ dev_err(dev, "MSI is enabled, cannot assert INTx\n");
return -EINVAL;
}
val = rcar_pci_read_reg(pcie, PCICONF(1));
if ((val & INTDIS)) {
- dev_err(pcie->dev, "INTx message transmission is disabled\n");
+ dev_err(dev, "INTx message transmission is disabled\n");
return -EINVAL;
}
val = rcar_pci_read_reg(pcie, PCIEINTXR);
if ((val & ASTINTX)) {
- dev_err(pcie->dev, "INTx is already asserted\n");
+ dev_err(dev, "INTx is already asserted\n");
return -EINVAL;
}
@@ -487,7 +491,7 @@ static int rcar_pcie_ep_probe(struct platform_device *pdev)
return -ENOMEM;
pcie = &ep->pcie;
- pcie->dev = dev;
+ pcie->pdev = pdev;
pm_runtime_enable(dev);
err = pm_runtime_resume_and_get(dev);
@@ -496,7 +500,7 @@ static int rcar_pcie_ep_probe(struct platform_device *pdev)
goto err_pm_disable;
}
- err = rcar_pcie_ep_get_pdata(ep, pdev);
+ err = rcar_pcie_ep_get_pdata(ep);
if (err < 0) {
dev_err(dev, "failed to request resources: %d\n", err);
goto err_pm_put;
diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c
index e12c2d8be05a..4984e4d0078d 100644
--- a/drivers/pci/controller/pcie-rcar-host.c
+++ b/drivers/pci/controller/pcie-rcar-host.c
@@ -216,7 +216,7 @@ static struct pci_ops rcar_pcie_ops = {
static void rcar_pcie_force_speedup(struct rcar_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
unsigned int timeout = 1000;
u32 macsr;
@@ -312,7 +312,7 @@ static int rcar_pcie_enable(struct rcar_pcie_host *host)
static int phy_wait_for_ack(struct rcar_pcie *pcie)
{
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
unsigned int timeout = 100;
while (timeout--) {
@@ -490,7 +490,7 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
struct rcar_pcie_host *host = data;
struct rcar_pcie *pcie = &host->pcie;
struct rcar_msi *msi = &host->msi;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
unsigned long reg;
reg = rcar_pci_read_reg(pcie, PCIEMSIFR);
@@ -653,20 +653,21 @@ static struct msi_domain_info rcar_msi_info = {
static int rcar_allocate_domains(struct rcar_msi *msi)
{
struct rcar_pcie *pcie = &msi_to_host(msi)->pcie;
- struct fwnode_handle *fwnode = dev_fwnode(pcie->dev);
+ struct device *dev = &pcie->pdev->dev;
+ struct fwnode_handle *fwnode = dev_fwnode(dev);
struct irq_domain *parent;
parent = irq_domain_create_linear(fwnode, INT_PCI_MSI_NR,
&rcar_msi_domain_ops, msi);
if (!parent) {
- dev_err(pcie->dev, "failed to create IRQ domain\n");
+ dev_err(dev, "failed to create IRQ domain\n");
return -ENOMEM;
}
irq_domain_update_bus_token(parent, DOMAIN_BUS_NEXUS);
msi->domain = pci_msi_create_irq_domain(fwnode, &rcar_msi_info, parent);
if (!msi->domain) {
- dev_err(pcie->dev, "failed to create MSI domain\n");
+ dev_err(dev, "failed to create MSI domain\n");
irq_domain_remove(parent);
return -ENOMEM;
}
@@ -685,7 +686,7 @@ static void rcar_free_domains(struct rcar_msi *msi)
static int rcar_pcie_enable_msi(struct rcar_pcie_host *host)
{
struct rcar_pcie *pcie = &host->pcie;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct rcar_msi *msi = &host->msi;
struct resource res;
int err;
@@ -751,7 +752,7 @@ static void rcar_pcie_teardown_msi(struct rcar_pcie_host *host)
static int rcar_pcie_get_resources(struct rcar_pcie_host *host)
{
struct rcar_pcie *pcie = &host->pcie;
- struct device *dev = pcie->dev;
+ struct device *dev = &pcie->pdev->dev;
struct resource res;
int err, i;
@@ -821,7 +822,7 @@ static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,
while (cpu_addr < cpu_end) {
if (idx >= MAX_NR_INBOUND_MAPS - 1) {
- dev_err(pcie->dev, "Failed to map inbound regions!\n");
+ dev_err(&pcie->pdev->dev, "Failed to map inbound regions!\n");
return -EINVAL;
}
/*
@@ -899,13 +900,13 @@ static int rcar_pcie_probe(struct platform_device *pdev)
host = pci_host_bridge_priv(bridge);
pcie = &host->pcie;
- pcie->dev = dev;
+ pcie->pdev = pdev;
platform_set_drvdata(pdev, host);
- pm_runtime_enable(pcie->dev);
- err = pm_runtime_get_sync(pcie->dev);
+ pm_runtime_enable(dev);
+ err = pm_runtime_get_sync(dev);
if (err < 0) {
- dev_err(pcie->dev, "pm_runtime_get_sync failed\n");
+ dev_err(dev, "pm_runtime_get_sync failed\n");
goto err_pm_put;
}
diff --git a/drivers/pci/controller/pcie-rcar.h b/drivers/pci/controller/pcie-rcar.h
index 9bb125db85c6..1f33ceb51b83 100644
--- a/drivers/pci/controller/pcie-rcar.h
+++ b/drivers/pci/controller/pcie-rcar.h
@@ -125,7 +125,7 @@
#define MAX_NR_INBOUND_MAPS 6
struct rcar_pcie {
- struct device *dev;
+ struct platform_device *pdev;
void __iomem *base;
};
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 00/13] Unify device * to platform_device *
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
` (12 preceding siblings ...)
2021-11-27 14:11 ` [PATCH 13/13] PCI: rcar: " Fan Fei
@ 2021-12-23 0:43 ` Bjorn Helgaas
2021-12-28 19:38 ` Fan Fei
13 siblings, 1 reply; 17+ messages in thread
From: Bjorn Helgaas @ 2021-12-23 0:43 UTC (permalink / raw)
To: Fan Fei; +Cc: bjorn, linux-pci
On Sat, Nov 27, 2021 at 03:11:08PM +0100, Fan Fei wrote:
> Some PCI controller structs contain "device *", while others contain
> "platform_device *". These patches unify "device *dev" to
> "platform_device *pdev" in 13 controller struct, to make the controller
> struct more consistent. Consider that PCI controllers interact with
> platform_device directly, not device, to enumerate the controlled device.
I went through all the controller drivers using a command like this:
git grep -A4 -E "^struct .*_pci.?\> \{$" drivers/pci/controller/
and found that almost all of them hang onto the "struct device *", not
the "struct platform_device *". Many of these are buried inside
struct dw_pcie and struct cdns_pcie.
I know I've gone back and forth on this, but I don't think the churn
of converting some of them to keep the "struct platform_device *"
would be worthwhile.
The preceding series that renamed the controller structs made this
exploration quite a bit easier, so I do plan to apply that series.
> Fan Fei (13):
> PCI: xilinx: Replace device * with platform_device *
> PCI: mediatek: Replace device * with platform_device *
> PCI: tegra: Replace device * with platform_device *
> PCI: xegene: Replace device * with platform_device *
> PCI: microchip: Replace device * with platform_device *
> PCI: brcmstb: Replace device * with platform_device *
> PCI: mediatek-gen3: Replace device * with platform_device *
> PCI: rcar-gen2: Replace device * with platform_device *
> PCI: ftpci100: Replace device * with platform_device *
> PCI: v3-semi: Replace device * with platform_device *
> PCI: ixp4xx: Replace device * with platform_device *
> PCI: xilinx-nwl: Replace device * with platform_device *
> PCI: rcar: Replace device * with platform_device *
>
> drivers/pci/controller/pci-ftpci100.c | 15 +-
> drivers/pci/controller/pci-ixp4xx.c | 47 ++--
> drivers/pci/controller/pci-rcar-gen2.c | 10 +-
> drivers/pci/controller/pci-tegra.c | 85 +++----
> drivers/pci/controller/pci-v3-semi.c | 19 +-
> drivers/pci/controller/pci-xgene.c | 222 +++++++++----------
> drivers/pci/controller/pcie-brcmstb.c | 35 +--
> drivers/pci/controller/pcie-mediatek-gen3.c | 36 +--
> drivers/pci/controller/pcie-mediatek.c | 31 +--
> drivers/pci/controller/pcie-microchip-host.c | 18 +-
> drivers/pci/controller/pcie-rcar-ep.c | 40 ++--
> drivers/pci/controller/pcie-rcar-host.c | 27 +--
> drivers/pci/controller/pcie-rcar.h | 2 +-
> drivers/pci/controller/pcie-xilinx-nwl.c | 28 +--
> drivers/pci/controller/pcie-xilinx.c | 21 +-
> 15 files changed, 328 insertions(+), 308 deletions(-)
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 00/13] Unify device * to platform_device *
2021-12-23 0:43 ` [PATCH 00/13] Unify device * to " Bjorn Helgaas
@ 2021-12-28 19:38 ` Fan Fei
2021-12-29 17:14 ` Bjorn Helgaas
0 siblings, 1 reply; 17+ messages in thread
From: Fan Fei @ 2021-12-28 19:38 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, bjorn
On Wed, Dec 22, 2021 at 06:43:37PM -0600, Bjorn Helgaas wrote:
Hi, Bjorn
> On Sat, Nov 27, 2021 at 03:11:08PM +0100, Fan Fei wrote:
> > Some PCI controller structs contain "device *", while others contain
> > "platform_device *". These patches unify "device *dev" to
> > "platform_device *pdev" in 13 controller struct, to make the controller
> > struct more consistent. Consider that PCI controllers interact with
> > platform_device directly, not device, to enumerate the controlled
> > device.
>
> I went through all the controller drivers using a command like this:
>
> git grep -A4 -E "^struct .*_pci.?\> \{$" drivers/pci/controller/
>
> and found that almost all of them hang onto the "struct device *", not
> the "struct platform_device *". Many of these are buried inside struct
> dw_pcie and struct cdns_pcie.
>
Do you mean most of these structs contain dw_pcie and cdns_pcie, both of
which contain "sturct device *"? I did realize this is not consistent with
other controller device if we make this change.
> I know I've gone back and forth on this, but I don't think the churn of
> converting some of them to keep the "struct platform_device *" would be
> worthwhile.
>
I could convert "platform_device *" back to "device *", e.g. in the
pcie-altear.c. What do you think?
> The preceding series that renamed the controller structs made this
> exploration quite a bit easier, so I do plan to apply that series.
>
> > Fan Fei (13): PCI: xilinx: Replace device * with platform_device * PCI:
> > mediatek: Replace device * with platform_device * PCI: tegra: Replace
> > device * with platform_device * PCI: xegene: Replace device * with
> > platform_device * PCI: microchip: Replace device * with platform_device
> > * PCI: brcmstb: Replace device * with platform_device * PCI:
> > mediatek-gen3: Replace device * with platform_device * PCI: rcar-gen2:
> > Replace device * with platform_device * PCI: ftpci100: Replace device *
> > with platform_device * PCI: v3-semi: Replace device * with
> > platform_device * PCI: ixp4xx: Replace device * with platform_device *
> > PCI: xilinx-nwl: Replace device * with platform_device * PCI: rcar:
> > Replace device * with platform_device *
> >
> > drivers/pci/controller/pci-ftpci100.c | 15 +-
> > drivers/pci/controller/pci-ixp4xx.c | 47 ++--
> > drivers/pci/controller/pci-rcar-gen2.c | 10 +-
> > drivers/pci/controller/pci-tegra.c | 85 +++----
> > drivers/pci/controller/pci-v3-semi.c | 19 +-
> > drivers/pci/controller/pci-xgene.c | 222 +++++++++----------
> > drivers/pci/controller/pcie-brcmstb.c | 35 +--
> > drivers/pci/controller/pcie-mediatek-gen3.c | 36 +--
> > drivers/pci/controller/pcie-mediatek.c | 31 +--
> > drivers/pci/controller/pcie-microchip-host.c | 18 +-
> > drivers/pci/controller/pcie-rcar-ep.c | 40 ++--
> > drivers/pci/controller/pcie-rcar-host.c | 27 +--
> > drivers/pci/controller/pcie-rcar.h | 2 +-
> > drivers/pci/controller/pcie-xilinx-nwl.c | 28 +--
> > drivers/pci/controller/pcie-xilinx.c | 21 +- 15 files
> > changed, 328 insertions(+), 308 deletions(-)
> >
> > -- 2.25.1
> >
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 00/13] Unify device * to platform_device *
2021-12-28 19:38 ` Fan Fei
@ 2021-12-29 17:14 ` Bjorn Helgaas
0 siblings, 0 replies; 17+ messages in thread
From: Bjorn Helgaas @ 2021-12-29 17:14 UTC (permalink / raw)
To: Fan Fei; +Cc: linux-pci, bjorn
On Tue, Dec 28, 2021 at 08:38:01PM +0100, Fan Fei wrote:
> On Wed, Dec 22, 2021 at 06:43:37PM -0600, Bjorn Helgaas wrote:
> > On Sat, Nov 27, 2021 at 03:11:08PM +0100, Fan Fei wrote:
> > > Some PCI controller structs contain "device *", while others contain
> > > "platform_device *". These patches unify "device *dev" to
> > > "platform_device *pdev" in 13 controller struct, to make the controller
> > > struct more consistent. Consider that PCI controllers interact with
> > > platform_device directly, not device, to enumerate the controlled
> > > device.
> >
> > I went through all the controller drivers using a command like this:
> >
> > git grep -A4 -E "^struct .*_pci.?\> \{$" drivers/pci/controller/
> >
> > and found that almost all of them hang onto the "struct device *", not
> > the "struct platform_device *". Many of these are buried inside struct
> > dw_pcie and struct cdns_pcie.
> >
> Do you mean most of these structs contain dw_pcie and cdns_pcie, both of
> which contain "sturct device *"?
Yes.
> > I know I've gone back and forth on this, but I don't think the churn of
> > converting some of them to keep the "struct platform_device *" would be
> > worthwhile.
> >
> I could convert "platform_device *" back to "device *", e.g. in the
> pcie-altear.c. What do you think?
No, I don't think we should do that. I don't think there's really any
benefit right now.
Bjorn
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2021-12-29 17:14 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
2021-11-27 14:11 ` [PATCH 01/13] PCI: xilinx: Replace device * with " Fan Fei
2021-11-27 14:11 ` [PATCH 02/13] PCI: mediatek: " Fan Fei
2021-11-27 14:11 ` [PATCH 03/13] PCI: tegra: " Fan Fei
2021-11-27 14:11 ` [PATCH 04/13] PCI: xegene: " Fan Fei
2021-11-27 14:11 ` [PATCH 05/13] PCI: microchip: " Fan Fei
2021-11-27 14:11 ` [PATCH 06/13] PCI: brcmstb: " Fan Fei
2021-11-27 14:11 ` [PATCH 07/13] PCI: mediatek-gen3: " Fan Fei
2021-11-27 14:11 ` [PATCH 08/13] PCI: rcar-gen2: " Fan Fei
2021-11-27 14:11 ` [PATCH 09/13] PCI: ftpci100: " Fan Fei
2021-11-27 14:11 ` [PATCH 10/13] PCI: v3-semi: " Fan Fei
2021-11-27 14:11 ` [PATCH 11/13] PCI: ixp4xx: " Fan Fei
2021-11-27 14:11 ` [PATCH 12/13] PCI: xilinx-nwl: " Fan Fei
2021-11-27 14:11 ` [PATCH 13/13] PCI: rcar: " Fan Fei
2021-12-23 0:43 ` [PATCH 00/13] Unify device * to " Bjorn Helgaas
2021-12-28 19:38 ` Fan Fei
2021-12-29 17:14 ` Bjorn Helgaas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.