struct clk;
 struct icc_path;
 struct net_device;
-struct platform_device;
 
 struct ipa_power;
 struct ipa_smp2p;
  * struct ipa - IPA information
  * @gsi:               Embedded GSI structure
  * @version:           IPA hardware version
- * @pdev:              Platform device
+ * @dev:               IPA device pointer
  * @completion:                Used to signal pipeline clear transfer complete
  * @nb:                        Notifier block used for remoteproc SSR
  * @notifier:          Remoteproc SSR notifier
 struct ipa {
        struct gsi gsi;
        enum ipa_version version;
-       struct platform_device *pdev;
+       struct device *dev;
        struct completion completion;
        struct notifier_block nb;
        void *notifier;
 
        u32 offset_max = field_max(IP_FLTRT_FLAGS_NHASH_ADDR_FMASK);
        u32 size_max = field_max(IP_FLTRT_FLAGS_NHASH_SIZE_FMASK);
        const char *table = route ? "route" : "filter";
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        u32 size;
 
        size = route ? ipa->route_count : ipa->filter_count + 1;
 /* Validate the memory region that holds headers */
 static bool ipa_cmd_header_init_local_valid(struct ipa *ipa)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        const struct ipa_mem *mem;
        u32 offset_max;
        u32 size_max;
                                                const char *name, u32 offset)
 {
        struct ipa_cmd_register_write *payload;
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        u32 offset_max;
        u32 bit_count;
 
 
                            const struct ipa_gsi_endpoint_data *data)
 {
        const struct ipa_gsi_endpoint_data *other_data;
-       struct device *dev = &ipa->pdev->dev;
        enum ipa_endpoint_name other_name;
+       struct device *dev = ipa->dev;
 
        if (ipa_gsi_endpoint_data_empty(data))
                return true;
                            const struct ipa_gsi_endpoint_data *data)
 {
        const struct ipa_gsi_endpoint_data *dp = data;
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        enum ipa_endpoint_name name;
        u32 max;
 
        count = ipa->modem_tx_count + ipa_cmd_pipeline_clear_count();
        trans = ipa_cmd_trans_alloc(ipa, count);
        if (!trans) {
-               dev_err(&ipa->pdev->dev,
+               dev_err(ipa->dev,
                        "no transaction to reset modem exception endpoints\n");
                return -EBUSY;
        }
        if (endpoint_id == command_endpoint->endpoint_id) {
                complete(&ipa->completion);
        } else {
-               dev_err(&ipa->pdev->dev,
-                       "unexpected tagged packet from endpoint %u\n",
+               dev_err(ipa->dev, "unexpected tagged packet from endpoint %u\n",
                        endpoint_id);
        }
 
        void *data = page_address(page) + NET_SKB_PAD;
        u32 unused = buffer_size - total_len;
        struct ipa *ipa = endpoint->ipa;
+       struct device *dev = ipa->dev;
        u32 resid = total_len;
 
        while (resid) {
                u32 len;
 
                if (resid < IPA_STATUS_SIZE) {
-                       dev_err(&endpoint->ipa->pdev->dev,
+                       dev_err(dev,
                                "short message (%u bytes < %zu byte status)\n",
                                resid, IPA_STATUS_SIZE);
                        break;
  */
 static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint)
 {
-       struct device *dev = &endpoint->ipa->pdev->dev;
        struct ipa *ipa = endpoint->ipa;
+       struct device *dev = ipa->dev;
        struct gsi *gsi = &ipa->gsi;
        bool suspended = false;
        dma_addr_t addr;
                gsi_channel_reset(&ipa->gsi, channel_id, true);
 
        if (ret)
-               dev_err(&ipa->pdev->dev,
+               dev_err(ipa->dev,
                        "error %d resetting channel %u for endpoint %u\n",
                        ret, endpoint->channel_id, endpoint->endpoint_id);
 }
 
        ret = gsi_channel_start(gsi, endpoint->channel_id);
        if (ret) {
-               dev_err(&ipa->pdev->dev,
+               dev_err(ipa->dev,
                        "error %d starting %cX channel %u for endpoint %u\n",
                        ret, endpoint->toward_ipa ? 'T' : 'R',
                        endpoint->channel_id, endpoint_id);
        /* Note that if stop fails, the channel's state is not well-defined */
        ret = gsi_channel_stop(gsi, endpoint->channel_id);
        if (ret)
-               dev_err(&ipa->pdev->dev,
-                       "error %d attempting to stop endpoint %u\n", ret,
-                       endpoint_id);
+               dev_err(ipa->dev, "error %d attempting to stop endpoint %u\n",
+                       ret, endpoint_id);
 }
 
 void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint)
 {
-       struct device *dev = &endpoint->ipa->pdev->dev;
+       struct device *dev = endpoint->ipa->dev;
        struct gsi *gsi = &endpoint->ipa->gsi;
        int ret;
 
 
 void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint)
 {
-       struct device *dev = &endpoint->ipa->pdev->dev;
+       struct device *dev = endpoint->ipa->dev;
        struct gsi *gsi = &endpoint->ipa->gsi;
        int ret;
 
 
 int ipa_endpoint_config(struct ipa *ipa)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        const struct reg *reg;
        u32 endpoint_id;
        u32 hw_limit;
 
        struct ipa_interrupt *interrupt = dev_id;
        struct ipa *ipa = interrupt->ipa;
        u32 enabled = interrupt->enabled;
+       struct device *dev = ipa->dev;
        const struct reg *reg;
-       struct device *dev;
        u32 pending;
        u32 offset;
        u32 mask;
        int ret;
 
-       dev = &ipa->pdev->dev;
        ret = pm_runtime_get_sync(dev);
        if (WARN_ON(ret < 0))
                goto out_power_put;
 int ipa_interrupt_config(struct ipa *ipa)
 {
        struct ipa_interrupt *interrupt = ipa->interrupt;
-       struct device *dev = &ipa->pdev->dev;
        unsigned int irq = interrupt->irq;
+       struct device *dev = ipa->dev;
        const struct reg *reg;
        int ret;
 
 void ipa_interrupt_deconfig(struct ipa *ipa)
 {
        struct ipa_interrupt *interrupt = ipa->interrupt;
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
 
        ipa->interrupt = NULL;
 
 
 #include <linux/types.h>
 #include <linux/atomic.h>
 #include <linux/bitfield.h>
-#include <linux/device.h>
 #include <linux/bug.h>
 #include <linux/io.h>
 #include <linux/firmware.h>
 {
        struct ipa_endpoint *exception_endpoint;
        struct ipa_endpoint *command_endpoint;
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        int ret;
 
        ret = gsi_setup(&ipa->gsi);
                goto err_power_exit;
        }
 
-       ipa->pdev = pdev;
+       ipa->dev = dev;
        dev_set_drvdata(dev, ipa);
        ipa->interrupt = interrupt;
        ipa->power = power;
 
 static void ipa_remove(struct platform_device *pdev)
 {
-       struct ipa *ipa = dev_get_drvdata(&pdev->dev);
-       struct device *dev = &pdev->dev;
        struct ipa_interrupt *interrupt;
        struct ipa_power *power;
+       struct device *dev;
+       struct ipa *ipa;
        int ret;
 
+       ipa = dev_get_drvdata(&pdev->dev);
+       dev = ipa->dev;
+       WARN_ON(dev != &pdev->dev);
+
        power = ipa->power;
        interrupt = ipa->interrupt;
 
 
         */
        trans = ipa_cmd_trans_alloc(ipa, 4);
        if (!trans) {
-               dev_err(&ipa->pdev->dev, "no transaction for memory setup\n");
+               dev_err(ipa->dev, "no transaction for memory setup\n");
                return -EBUSY;
        }
 
 
 static bool ipa_mem_valid_one(struct ipa *ipa, const struct ipa_mem *mem)
 {
-       struct device *dev = &ipa->pdev->dev;
        enum ipa_mem_id mem_id = mem->id;
+       struct device *dev = ipa->dev;
        u16 size_multiple;
 
        /* Make sure the memory region is valid for this version of IPA */
 static bool ipa_mem_valid(struct ipa *ipa, const struct ipa_mem_data *mem_data)
 {
        DECLARE_BITMAP(regions, IPA_MEM_COUNT) = { };
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        enum ipa_mem_id mem_id;
        u32 i;
 
 /* Do all memory regions fit within the IPA local memory? */
 static bool ipa_mem_size_valid(struct ipa *ipa)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        u32 limit = ipa->mem_size;
        u32 i;
 
  */
 int ipa_mem_config(struct ipa *ipa)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        const struct ipa_mem *mem;
        const struct reg *reg;
        dma_addr_t addr;
 /* Inverse of ipa_mem_config() */
 void ipa_mem_deconfig(struct ipa *ipa)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
 
        dma_free_coherent(dev, ipa->zero_size, ipa->zero_virt, ipa->zero_addr);
        ipa->zero_size = 0;
         */
        trans = ipa_cmd_trans_alloc(ipa, 3);
        if (!trans) {
-               dev_err(&ipa->pdev->dev,
-                       "no transaction to zero modem memory\n");
+               dev_err(ipa->dev, "no transaction to zero modem memory\n");
                return -EBUSY;
        }
 
  */
 static int ipa_imem_init(struct ipa *ipa, unsigned long addr, size_t size)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        struct iommu_domain *domain;
        unsigned long iova;
        phys_addr_t phys;
 
 static void ipa_imem_exit(struct ipa *ipa)
 {
+       struct device *dev = ipa->dev;
        struct iommu_domain *domain;
-       struct device *dev;
 
        if (!ipa->imem_size)
                return;
 
-       dev = &ipa->pdev->dev;
        domain = iommu_get_domain_for_dev(dev);
        if (domain) {
                size_t size;
  */
 static int ipa_smem_init(struct ipa *ipa, u32 item, size_t size)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        struct iommu_domain *domain;
        unsigned long iova;
        phys_addr_t phys;
 
 static void ipa_smem_exit(struct ipa *ipa)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        struct iommu_domain *domain;
 
        domain = iommu_get_domain_for_dev(dev);
 
        struct device *dev;
        int ret;
 
-       dev = &ipa->pdev->dev;
+       dev = ipa->dev;
        ret = pm_runtime_get_sync(dev);
        if (ret < 0)
                goto err_power_put;
        struct device *dev;
        int ret;
 
-       dev = &ipa->pdev->dev;
+       dev = ipa->dev;
        ret = pm_runtime_get_sync(dev);
        if (ret < 0)
                goto out_power_put;
         */
        netif_stop_queue(netdev);
 
-       dev = &ipa->pdev->dev;
+       dev = ipa->dev;
        ret = pm_runtime_get(dev);
        if (ret < 1) {
                /* If a resume won't happen, just drop the packet */
                goto out_set_state;
        }
 
-       SET_NETDEV_DEV(netdev, &ipa->pdev->dev);
+       SET_NETDEV_DEV(netdev, ipa->dev);
        priv = netdev_priv(netdev);
        priv->ipa = ipa;
        priv->tx = ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX];
 /* Treat a "clean" modem stop the same as a crash */
 static void ipa_modem_crashed(struct ipa *ipa)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        int ret;
 
        /* Prevent the modem from triggering a call to ipa_setup() */
 {
        struct ipa *ipa = container_of(nb, struct ipa, nb);
        struct qcom_ssr_notify_data *notify_data = data;
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
 
        switch (action) {
        case QCOM_SSR_BEFORE_POWERUP:
 
 void ipa_modem_deconfig(struct ipa *ipa)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        int ret;
 
        ret = qcom_unregister_ssr_notifier(ipa->notifier, &ipa->nb);
 
 
        ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND);
 
-       ret = device_init_wakeup(&ipa->pdev->dev, true);
+       ret = device_init_wakeup(ipa->dev, true);
        if (ret)
                ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND);
 
 
 void ipa_power_teardown(struct ipa *ipa)
 {
-       (void)device_init_wakeup(&ipa->pdev->dev, false);
+       (void)device_init_wakeup(ipa->dev, false);
        ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND);
 }
 
 
                                   IPA_QMI_INIT_COMPLETE_IND_SZ,
                                   ipa_init_complete_ind_ei, &ind);
        if (ret)
-               dev_err(&ipa->pdev->dev,
+               dev_err(ipa->dev,
                        "error %d sending init complete indication\n", ret);
        else
                ipa_qmi->indication_sent = true;
        ipa = container_of(ipa_qmi, struct ipa, qmi);
        ret = ipa_modem_start(ipa);
        if (ret)
-               dev_err(&ipa->pdev->dev, "error %d starting modem\n", ret);
+               dev_err(ipa->dev, "error %d starting modem\n", ret);
 }
 
 /* All QMI clients from the modem node are gone (modem shut down or crashed). */
                ipa_qmi->indication_requested = true;
                ipa_qmi_ready(ipa_qmi);         /* We might be ready now */
        } else {
-               dev_err(&ipa->pdev->dev,
+               dev_err(ipa->dev,
                        "error %d sending register indication response\n", ret);
        }
 }
                ipa_qmi->uc_ready = true;
                ipa_qmi_ready(ipa_qmi);         /* We might be ready now */
        } else {
-               dev_err(&ipa->pdev->dev,
+               dev_err(ipa->dev,
                        "error %d sending init complete response\n", ret);
        }
 }
        qmi = &ipa_qmi->client_handle;
 
        ipa = container_of(ipa_qmi, struct ipa, qmi);
-       dev = &ipa->pdev->dev;
+       dev = ipa->dev;
 
        ret = qmi_txn_init(qmi, &txn, NULL, NULL);
        if (ret < 0) {
 
  */
 static void ipa_smp2p_notify(struct ipa_smp2p *smp2p)
 {
-       struct device *dev;
        u32 value;
        u32 mask;
 
        if (smp2p->notified)
                return;
 
-       dev = &smp2p->ipa->pdev->dev;
-       smp2p->power_on = pm_runtime_get_if_active(dev, true) > 0;
+       smp2p->power_on = pm_runtime_get_if_active(smp2p->ipa->dev, true) > 0;
 
        /* Signal whether the IPA power is enabled */
        mask = BIT(smp2p->enabled_bit);
 static irqreturn_t ipa_smp2p_modem_setup_ready_isr(int irq, void *dev_id)
 {
        struct ipa_smp2p *smp2p = dev_id;
+       struct ipa *ipa = smp2p->ipa;
        struct device *dev;
        int ret;
 
        /* Ignore any (spurious) interrupts received after the first */
-       if (smp2p->ipa->setup_complete)
+       if (ipa->setup_complete)
                return IRQ_HANDLED;
 
        /* Power needs to be active for setup */
-       dev = &smp2p->ipa->pdev->dev;
+       dev = ipa->dev;
        ret = pm_runtime_get_sync(dev);
        if (ret < 0) {
                dev_err(dev, "error %d getting power for setup\n", ret);
        }
 
        /* An error here won't cause driver shutdown, so warn if one occurs */
-       ret = ipa_setup(smp2p->ipa);
+       ret = ipa_setup(ipa);
        WARN(ret != 0, "error %d from ipa_setup()\n", ret);
 
 out_power_put:
 /* Drop the power reference if it was taken in ipa_smp2p_notify() */
 static void ipa_smp2p_power_release(struct ipa *ipa)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
 
        if (!ipa->smp2p->power_on)
                return;
 
 
 bool ipa_filtered_valid(struct ipa *ipa, u64 filtered)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        u32 count;
 
        if (!filtered) {
 
        trans = ipa_cmd_trans_alloc(ipa, hweight64(ep_mask));
        if (!trans) {
-               dev_err(&ipa->pdev->dev,
-                       "no transaction for %s filter reset\n",
+               dev_err(ipa->dev, "no transaction for %s filter reset\n",
                        modem ? "modem" : "AP");
                return -EBUSY;
        }
 
        trans = ipa_cmd_trans_alloc(ipa, hash_support ? 4 : 2);
        if (!trans) {
-               dev_err(&ipa->pdev->dev,
-                       "no transaction for %s route reset\n",
+               dev_err(ipa->dev, "no transaction for %s route reset\n",
                        modem ? "modem" : "AP");
                return -EBUSY;
        }
 
 void ipa_table_reset(struct ipa *ipa, bool modem)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        const char *ee_name;
        int ret;
 
 
        trans = ipa_cmd_trans_alloc(ipa, 1);
        if (!trans) {
-               dev_err(&ipa->pdev->dev, "no transaction for hash flush\n");
+               dev_err(ipa->dev, "no transaction for hash flush\n");
                return -EBUSY;
        }
 
         */
        trans = ipa_cmd_trans_alloc(ipa, 8);
        if (!trans) {
-               dev_err(&ipa->pdev->dev, "no transaction for table setup\n");
+               dev_err(ipa->dev, "no transaction for table setup\n");
                return -EBUSY;
        }
 
  */
 int ipa_table_init(struct ipa *ipa)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        dma_addr_t addr;
        __le64 le_addr;
        __le64 *virt;
 void ipa_table_exit(struct ipa *ipa)
 {
        u32 count = max_t(u32, 1 + ipa->filter_count, ipa->route_count);
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
        size_t size;
 
        size = IPA_ZERO_RULE_SIZE + (1 + count) * sizeof(__le64);
 
 static void ipa_uc_event_handler(struct ipa *ipa)
 {
        struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa);
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
 
        if (shared->event == IPA_UC_EVENT_ERROR)
                dev_err(dev, "microcontroller error event\n");
 static void ipa_uc_response_hdlr(struct ipa *ipa)
 {
        struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa);
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
 
        /* An INIT_COMPLETED response message is sent to the AP by the
         * microcontroller when it is operational.  Other than this, the AP
 /* Inverse of ipa_uc_config() */
 void ipa_uc_deconfig(struct ipa *ipa)
 {
-       struct device *dev = &ipa->pdev->dev;
+       struct device *dev = ipa->dev;
 
        ipa_interrupt_disable(ipa, IPA_IRQ_UC_1);
        ipa_interrupt_disable(ipa, IPA_IRQ_UC_0);
 /* Take a proxy power reference for the microcontroller */
 void ipa_uc_power(struct ipa *ipa)
 {
+       struct device *dev = ipa->dev;
        static bool already;
-       struct device *dev;
        int ret;
 
        if (already)
        already = true;         /* Only do this on first boot */
 
        /* This power reference dropped in ipa_uc_response_hdlr() above */
-       dev = &ipa->pdev->dev;
        ret = pm_runtime_get_sync(dev);
        if (ret < 0) {
                pm_runtime_put_noidle(dev);