Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 
0003 /* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
0004  * Copyright (C) 2018-2020 Linaro Ltd.
0005  */
0006 
0007 #include <linux/types.h>
0008 #include <linux/string.h>
0009 #include <linux/slab.h>
0010 #include <linux/qrtr.h>
0011 #include <linux/soc/qcom/qmi.h>
0012 
0013 #include "ipa.h"
0014 #include "ipa_endpoint.h"
0015 #include "ipa_mem.h"
0016 #include "ipa_table.h"
0017 #include "ipa_modem.h"
0018 #include "ipa_qmi_msg.h"
0019 
0020 /**
0021  * DOC: AP/Modem QMI Handshake
0022  *
0023  * The AP and modem perform a "handshake" at initialization time to ensure
0024  * both sides know when everything is ready to begin operating.  The AP
0025  * driver (this code) uses two QMI handles (endpoints) for this; a client
0026  * using a service on the modem, and server to service modem requests (and
0027  * to supply an indication message from the AP).  Once the handshake is
0028  * complete, the AP and modem may begin IPA operation.  This occurs
0029  * only when the AP IPA driver, modem IPA driver, and IPA microcontroller
0030  * are ready.
0031  *
0032  * The QMI service on the modem expects to receive an INIT_DRIVER request from
0033  * the AP, which contains parameters used by the modem during initialization.
0034  * The AP sends this request as soon as it is knows the modem side service
0035  * is available.  The modem responds to this request, and if this response
0036  * contains a success result, the AP knows the modem IPA driver is ready.
0037  *
0038  * The modem is responsible for loading firmware on the IPA microcontroller.
0039  * This occurs only during the initial modem boot.  The modem sends a
0040  * separate DRIVER_INIT_COMPLETE request to the AP to report that the
0041  * microcontroller is ready.  The AP may assume the microcontroller is
0042  * ready and remain so (even if the modem reboots) once it has received
0043  * and responded to this request.
0044  *
0045  * There is one final exchange involved in the handshake.  It is required
0046  * on the initial modem boot, but optional (but in practice does occur) on
0047  * subsequent boots.  The modem expects to receive a final INIT_COMPLETE
0048  * indication message from the AP when it is about to begin its normal
0049  * operation.  The AP will only send this message after it has received
0050  * and responded to an INDICATION_REGISTER request from the modem.
0051  *
0052  * So in summary:
0053  * - Whenever the AP learns the modem has booted and its IPA QMI service
0054  *   is available, it sends an INIT_DRIVER request to the modem.  The
0055  *   modem supplies a success response when it is ready to operate.
0056  * - On the initial boot, the modem sets up the IPA microcontroller, and
0057  *   sends a DRIVER_INIT_COMPLETE request to the AP when this is done.
0058  * - When the modem is ready to receive an INIT_COMPLETE indication from
0059  *   the AP, it sends an INDICATION_REGISTER request to the AP.
0060  * - On the initial modem boot, everything is ready when:
0061  *  - AP has received a success response from its INIT_DRIVER request
0062  *  - AP has responded to a DRIVER_INIT_COMPLETE request
0063  *  - AP has responded to an INDICATION_REGISTER request from the modem
0064  *  - AP has sent an INIT_COMPLETE indication to the modem
0065  * - On subsequent modem boots, everything is ready when:
0066  *  - AP has received a success response from its INIT_DRIVER request
0067  *  - AP has responded to a DRIVER_INIT_COMPLETE request
0068  * - The INDICATION_REGISTER request and INIT_COMPLETE indication are
0069  *   optional for non-initial modem boots, and have no bearing on the
0070  *   determination of when things are "ready"
0071  */
0072 
0073 #define IPA_HOST_SERVICE_SVC_ID     0x31
0074 #define IPA_HOST_SVC_VERS       1
0075 #define IPA_HOST_SERVICE_INS_ID     1
0076 
0077 #define IPA_MODEM_SERVICE_SVC_ID    0x31
0078 #define IPA_MODEM_SERVICE_INS_ID    2
0079 #define IPA_MODEM_SVC_VERS      1
0080 
0081 #define QMI_INIT_DRIVER_TIMEOUT     60000   /* A minute in milliseconds */
0082 
0083 /* Send an INIT_COMPLETE indication message to the modem */
0084 static void ipa_server_init_complete(struct ipa_qmi *ipa_qmi)
0085 {
0086     struct ipa *ipa = container_of(ipa_qmi, struct ipa, qmi);
0087     struct qmi_handle *qmi = &ipa_qmi->server_handle;
0088     struct sockaddr_qrtr *sq = &ipa_qmi->modem_sq;
0089     struct ipa_init_complete_ind ind = { };
0090     int ret;
0091 
0092     ind.status.result = QMI_RESULT_SUCCESS_V01;
0093     ind.status.error = QMI_ERR_NONE_V01;
0094 
0095     ret = qmi_send_indication(qmi, sq, IPA_QMI_INIT_COMPLETE,
0096                    IPA_QMI_INIT_COMPLETE_IND_SZ,
0097                    ipa_init_complete_ind_ei, &ind);
0098     if (ret)
0099         dev_err(&ipa->pdev->dev,
0100             "error %d sending init complete indication\n", ret);
0101     else
0102         ipa_qmi->indication_sent = true;
0103 }
0104 
0105 /* If requested (and not already sent) send the INIT_COMPLETE indication */
0106 static void ipa_qmi_indication(struct ipa_qmi *ipa_qmi)
0107 {
0108     if (!ipa_qmi->indication_requested)
0109         return;
0110 
0111     if (ipa_qmi->indication_sent)
0112         return;
0113 
0114     ipa_server_init_complete(ipa_qmi);
0115 }
0116 
0117 /* Determine whether everything is ready to start normal operation.
0118  * We know everything (else) is ready when we know the IPA driver on
0119  * the modem is ready, and the microcontroller is ready.
0120  *
0121  * When the modem boots (or reboots), the handshake sequence starts
0122  * with the AP sending the modem an INIT_DRIVER request.  Within
0123  * that request, the uc_loaded flag will be zero (false) for an
0124  * initial boot, non-zero (true) for a subsequent (SSR) boot.
0125  */
0126 static void ipa_qmi_ready(struct ipa_qmi *ipa_qmi)
0127 {
0128     struct ipa *ipa;
0129     int ret;
0130 
0131     /* We aren't ready until the modem and microcontroller are */
0132     if (!ipa_qmi->modem_ready || !ipa_qmi->uc_ready)
0133         return;
0134 
0135     /* Send the indication message if it was requested */
0136     ipa_qmi_indication(ipa_qmi);
0137 
0138     /* The initial boot requires us to send the indication. */
0139     if (ipa_qmi->initial_boot) {
0140         if (!ipa_qmi->indication_sent)
0141             return;
0142 
0143         /* The initial modem boot completed successfully */
0144         ipa_qmi->initial_boot = false;
0145     }
0146 
0147     /* We're ready.  Start up normal operation */
0148     ipa = container_of(ipa_qmi, struct ipa, qmi);
0149     ret = ipa_modem_start(ipa);
0150     if (ret)
0151         dev_err(&ipa->pdev->dev, "error %d starting modem\n", ret);
0152 }
0153 
0154 /* All QMI clients from the modem node are gone (modem shut down or crashed). */
0155 static void ipa_server_bye(struct qmi_handle *qmi, unsigned int node)
0156 {
0157     struct ipa_qmi *ipa_qmi;
0158 
0159     ipa_qmi = container_of(qmi, struct ipa_qmi, server_handle);
0160 
0161     /* The modem client and server go away at the same time */
0162     memset(&ipa_qmi->modem_sq, 0, sizeof(ipa_qmi->modem_sq));
0163 
0164     /* initial_boot doesn't change when modem reboots */
0165     /* uc_ready doesn't change when modem reboots */
0166     ipa_qmi->modem_ready = false;
0167     ipa_qmi->indication_requested = false;
0168     ipa_qmi->indication_sent = false;
0169 }
0170 
0171 static const struct qmi_ops ipa_server_ops = {
0172     .bye        = ipa_server_bye,
0173 };
0174 
0175 /* Callback function to handle an INDICATION_REGISTER request message from the
0176  * modem.  This informs the AP that the modem is now ready to receive the
0177  * INIT_COMPLETE indication message.
0178  */
0179 static void ipa_server_indication_register(struct qmi_handle *qmi,
0180                        struct sockaddr_qrtr *sq,
0181                        struct qmi_txn *txn,
0182                        const void *decoded)
0183 {
0184     struct ipa_indication_register_rsp rsp = { };
0185     struct ipa_qmi *ipa_qmi;
0186     struct ipa *ipa;
0187     int ret;
0188 
0189     ipa_qmi = container_of(qmi, struct ipa_qmi, server_handle);
0190     ipa = container_of(ipa_qmi, struct ipa, qmi);
0191 
0192     rsp.rsp.result = QMI_RESULT_SUCCESS_V01;
0193     rsp.rsp.error = QMI_ERR_NONE_V01;
0194 
0195     ret = qmi_send_response(qmi, sq, txn, IPA_QMI_INDICATION_REGISTER,
0196                 IPA_QMI_INDICATION_REGISTER_RSP_SZ,
0197                 ipa_indication_register_rsp_ei, &rsp);
0198     if (!ret) {
0199         ipa_qmi->indication_requested = true;
0200         ipa_qmi_ready(ipa_qmi);     /* We might be ready now */
0201     } else {
0202         dev_err(&ipa->pdev->dev,
0203             "error %d sending register indication response\n", ret);
0204     }
0205 }
0206 
0207 /* Respond to a DRIVER_INIT_COMPLETE request message from the modem. */
0208 static void ipa_server_driver_init_complete(struct qmi_handle *qmi,
0209                         struct sockaddr_qrtr *sq,
0210                         struct qmi_txn *txn,
0211                         const void *decoded)
0212 {
0213     struct ipa_driver_init_complete_rsp rsp = { };
0214     struct ipa_qmi *ipa_qmi;
0215     struct ipa *ipa;
0216     int ret;
0217 
0218     ipa_qmi = container_of(qmi, struct ipa_qmi, server_handle);
0219     ipa = container_of(ipa_qmi, struct ipa, qmi);
0220 
0221     rsp.rsp.result = QMI_RESULT_SUCCESS_V01;
0222     rsp.rsp.error = QMI_ERR_NONE_V01;
0223 
0224     ret = qmi_send_response(qmi, sq, txn, IPA_QMI_DRIVER_INIT_COMPLETE,
0225                 IPA_QMI_DRIVER_INIT_COMPLETE_RSP_SZ,
0226                 ipa_driver_init_complete_rsp_ei, &rsp);
0227     if (!ret) {
0228         ipa_qmi->uc_ready = true;
0229         ipa_qmi_ready(ipa_qmi);     /* We might be ready now */
0230     } else {
0231         dev_err(&ipa->pdev->dev,
0232             "error %d sending init complete response\n", ret);
0233     }
0234 }
0235 
0236 /* The server handles two request message types sent by the modem. */
0237 static const struct qmi_msg_handler ipa_server_msg_handlers[] = {
0238     {
0239         .type       = QMI_REQUEST,
0240         .msg_id     = IPA_QMI_INDICATION_REGISTER,
0241         .ei     = ipa_indication_register_req_ei,
0242         .decoded_size   = IPA_QMI_INDICATION_REGISTER_REQ_SZ,
0243         .fn     = ipa_server_indication_register,
0244     },
0245     {
0246         .type       = QMI_REQUEST,
0247         .msg_id     = IPA_QMI_DRIVER_INIT_COMPLETE,
0248         .ei     = ipa_driver_init_complete_req_ei,
0249         .decoded_size   = IPA_QMI_DRIVER_INIT_COMPLETE_REQ_SZ,
0250         .fn     = ipa_server_driver_init_complete,
0251     },
0252     { },
0253 };
0254 
0255 /* Handle an INIT_DRIVER response message from the modem. */
0256 static void ipa_client_init_driver(struct qmi_handle *qmi,
0257                    struct sockaddr_qrtr *sq,
0258                    struct qmi_txn *txn, const void *decoded)
0259 {
0260     txn->result = 0;    /* IPA_QMI_INIT_DRIVER request was successful */
0261     complete(&txn->completion);
0262 }
0263 
0264 /* The client handles one response message type sent by the modem. */
0265 static const struct qmi_msg_handler ipa_client_msg_handlers[] = {
0266     {
0267         .type       = QMI_RESPONSE,
0268         .msg_id     = IPA_QMI_INIT_DRIVER,
0269         .ei     = ipa_init_modem_driver_rsp_ei,
0270         .decoded_size   = IPA_QMI_INIT_DRIVER_RSP_SZ,
0271         .fn     = ipa_client_init_driver,
0272     },
0273     { },
0274 };
0275 
0276 /* Return a pointer to an init modem driver request structure, which contains
0277  * configuration parameters for the modem.  The modem may be started multiple
0278  * times, but generally these parameters don't change so we can reuse the
0279  * request structure once it's initialized.  The only exception is the
0280  * skip_uc_load field, which will be set only after the microcontroller has
0281  * reported it has completed its initialization.
0282  */
0283 static const struct ipa_init_modem_driver_req *
0284 init_modem_driver_req(struct ipa_qmi *ipa_qmi)
0285 {
0286     struct ipa *ipa = container_of(ipa_qmi, struct ipa, qmi);
0287     static struct ipa_init_modem_driver_req req;
0288     const struct ipa_mem *mem;
0289 
0290     /* The microcontroller is initialized on the first boot */
0291     req.skip_uc_load_valid = 1;
0292     req.skip_uc_load = ipa->uc_loaded ? 1 : 0;
0293 
0294     /* We only have to initialize most of it once */
0295     if (req.platform_type_valid)
0296         return &req;
0297 
0298     req.platform_type_valid = 1;
0299     req.platform_type = IPA_QMI_PLATFORM_TYPE_MSM_ANDROID;
0300 
0301     mem = ipa_mem_find(ipa, IPA_MEM_MODEM_HEADER);
0302     if (mem->size) {
0303         req.hdr_tbl_info_valid = 1;
0304         req.hdr_tbl_info.start = ipa->mem_offset + mem->offset;
0305         req.hdr_tbl_info.end = req.hdr_tbl_info.start + mem->size - 1;
0306     }
0307 
0308     mem = ipa_mem_find(ipa, IPA_MEM_V4_ROUTE);
0309     req.v4_route_tbl_info_valid = 1;
0310     req.v4_route_tbl_info.start = ipa->mem_offset + mem->offset;
0311     req.v4_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1;
0312 
0313     mem = ipa_mem_find(ipa, IPA_MEM_V6_ROUTE);
0314     req.v6_route_tbl_info_valid = 1;
0315     req.v6_route_tbl_info.start = ipa->mem_offset + mem->offset;
0316     req.v6_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1;
0317 
0318     mem = ipa_mem_find(ipa, IPA_MEM_V4_FILTER);
0319     req.v4_filter_tbl_start_valid = 1;
0320     req.v4_filter_tbl_start = ipa->mem_offset + mem->offset;
0321 
0322     mem = ipa_mem_find(ipa, IPA_MEM_V6_FILTER);
0323     req.v6_filter_tbl_start_valid = 1;
0324     req.v6_filter_tbl_start = ipa->mem_offset + mem->offset;
0325 
0326     mem = ipa_mem_find(ipa, IPA_MEM_MODEM);
0327     if (mem->size) {
0328         req.modem_mem_info_valid = 1;
0329         req.modem_mem_info.start = ipa->mem_offset + mem->offset;
0330         req.modem_mem_info.size = mem->size;
0331     }
0332 
0333     req.ctrl_comm_dest_end_pt_valid = 1;
0334     req.ctrl_comm_dest_end_pt =
0335         ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]->endpoint_id;
0336 
0337     /* skip_uc_load_valid and skip_uc_load are set above */
0338 
0339     mem = ipa_mem_find(ipa, IPA_MEM_MODEM_PROC_CTX);
0340     if (mem->size) {
0341         req.hdr_proc_ctx_tbl_info_valid = 1;
0342         req.hdr_proc_ctx_tbl_info.start =
0343             ipa->mem_offset + mem->offset;
0344         req.hdr_proc_ctx_tbl_info.end =
0345             req.hdr_proc_ctx_tbl_info.start + mem->size - 1;
0346     }
0347 
0348     /* Nothing to report for the compression table (zip_tbl_info) */
0349 
0350     mem = ipa_mem_find(ipa, IPA_MEM_V4_ROUTE_HASHED);
0351     if (mem->size) {
0352         req.v4_hash_route_tbl_info_valid = 1;
0353         req.v4_hash_route_tbl_info.start =
0354                 ipa->mem_offset + mem->offset;
0355         req.v4_hash_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1;
0356     }
0357 
0358     mem = ipa_mem_find(ipa, IPA_MEM_V6_ROUTE_HASHED);
0359     if (mem->size) {
0360         req.v6_hash_route_tbl_info_valid = 1;
0361         req.v6_hash_route_tbl_info.start =
0362             ipa->mem_offset + mem->offset;
0363         req.v6_hash_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1;
0364     }
0365 
0366     mem = ipa_mem_find(ipa, IPA_MEM_V4_FILTER_HASHED);
0367     if (mem->size) {
0368         req.v4_hash_filter_tbl_start_valid = 1;
0369         req.v4_hash_filter_tbl_start = ipa->mem_offset + mem->offset;
0370     }
0371 
0372     mem = ipa_mem_find(ipa, IPA_MEM_V6_FILTER_HASHED);
0373     if (mem->size) {
0374         req.v6_hash_filter_tbl_start_valid = 1;
0375         req.v6_hash_filter_tbl_start = ipa->mem_offset + mem->offset;
0376     }
0377 
0378     /* The stats fields are only valid for IPA v4.0+ */
0379     if (ipa->version >= IPA_VERSION_4_0) {
0380         mem = ipa_mem_find(ipa, IPA_MEM_STATS_QUOTA_MODEM);
0381         if (mem->size) {
0382             req.hw_stats_quota_base_addr_valid = 1;
0383             req.hw_stats_quota_base_addr =
0384                 ipa->mem_offset + mem->offset;
0385             req.hw_stats_quota_size_valid = 1;
0386             req.hw_stats_quota_size = ipa->mem_offset + mem->size;
0387         }
0388 
0389         /* If the DROP stats region is defined, include it */
0390         mem = ipa_mem_find(ipa, IPA_MEM_STATS_DROP);
0391         if (mem && mem->size) {
0392             req.hw_stats_drop_base_addr_valid = 1;
0393             req.hw_stats_drop_base_addr =
0394                 ipa->mem_offset + mem->offset;
0395             req.hw_stats_drop_size_valid = 1;
0396             req.hw_stats_drop_size = ipa->mem_offset + mem->size;
0397         }
0398     }
0399 
0400     return &req;
0401 }
0402 
0403 /* Send an INIT_DRIVER request to the modem, and wait for it to complete. */
0404 static void ipa_client_init_driver_work(struct work_struct *work)
0405 {
0406     unsigned long timeout = msecs_to_jiffies(QMI_INIT_DRIVER_TIMEOUT);
0407     const struct ipa_init_modem_driver_req *req;
0408     struct ipa_qmi *ipa_qmi;
0409     struct qmi_handle *qmi;
0410     struct qmi_txn txn;
0411     struct device *dev;
0412     struct ipa *ipa;
0413     int ret;
0414 
0415     ipa_qmi = container_of(work, struct ipa_qmi, init_driver_work);
0416     qmi = &ipa_qmi->client_handle;
0417 
0418     ipa = container_of(ipa_qmi, struct ipa, qmi);
0419     dev = &ipa->pdev->dev;
0420 
0421     ret = qmi_txn_init(qmi, &txn, NULL, NULL);
0422     if (ret < 0) {
0423         dev_err(dev, "error %d preparing init driver request\n", ret);
0424         return;
0425     }
0426 
0427     /* Send the request, and if successful wait for its response */
0428     req = init_modem_driver_req(ipa_qmi);
0429     ret = qmi_send_request(qmi, &ipa_qmi->modem_sq, &txn,
0430                    IPA_QMI_INIT_DRIVER, IPA_QMI_INIT_DRIVER_REQ_SZ,
0431                    ipa_init_modem_driver_req_ei, req);
0432     if (ret)
0433         dev_err(dev, "error %d sending init driver request\n", ret);
0434     else if ((ret = qmi_txn_wait(&txn, timeout)))
0435         dev_err(dev, "error %d awaiting init driver response\n", ret);
0436 
0437     if (!ret) {
0438         ipa_qmi->modem_ready = true;
0439         ipa_qmi_ready(ipa_qmi);     /* We might be ready now */
0440     } else {
0441         /* If any error occurs we need to cancel the transaction */
0442         qmi_txn_cancel(&txn);
0443     }
0444 }
0445 
0446 /* The modem server is now available.  We will send an INIT_DRIVER request
0447  * to the modem, but can't wait for it to complete in this callback thread.
0448  * Schedule a worker on the global workqueue to do that for us.
0449  */
0450 static int
0451 ipa_client_new_server(struct qmi_handle *qmi, struct qmi_service *svc)
0452 {
0453     struct ipa_qmi *ipa_qmi;
0454 
0455     ipa_qmi = container_of(qmi, struct ipa_qmi, client_handle);
0456 
0457     ipa_qmi->modem_sq.sq_family = AF_QIPCRTR;
0458     ipa_qmi->modem_sq.sq_node = svc->node;
0459     ipa_qmi->modem_sq.sq_port = svc->port;
0460 
0461     schedule_work(&ipa_qmi->init_driver_work);
0462 
0463     return 0;
0464 }
0465 
0466 static const struct qmi_ops ipa_client_ops = {
0467     .new_server = ipa_client_new_server,
0468 };
0469 
0470 /* Set up for QMI message exchange */
0471 int ipa_qmi_setup(struct ipa *ipa)
0472 {
0473     struct ipa_qmi *ipa_qmi = &ipa->qmi;
0474     int ret;
0475 
0476     ipa_qmi->initial_boot = true;
0477 
0478     /* The server handle is used to handle the DRIVER_INIT_COMPLETE
0479      * request on the first modem boot.  It also receives the
0480      * INDICATION_REGISTER request on the first boot and (optionally)
0481      * subsequent boots.  The INIT_COMPLETE indication message is
0482      * sent over the server handle if requested.
0483      */
0484     ret = qmi_handle_init(&ipa_qmi->server_handle,
0485                   IPA_QMI_SERVER_MAX_RCV_SZ, &ipa_server_ops,
0486                   ipa_server_msg_handlers);
0487     if (ret)
0488         return ret;
0489 
0490     ret = qmi_add_server(&ipa_qmi->server_handle, IPA_HOST_SERVICE_SVC_ID,
0491                  IPA_HOST_SVC_VERS, IPA_HOST_SERVICE_INS_ID);
0492     if (ret)
0493         goto err_server_handle_release;
0494 
0495     /* The client handle is only used for sending an INIT_DRIVER request
0496      * to the modem, and receiving its response message.
0497      */
0498     ret = qmi_handle_init(&ipa_qmi->client_handle,
0499                   IPA_QMI_CLIENT_MAX_RCV_SZ, &ipa_client_ops,
0500                   ipa_client_msg_handlers);
0501     if (ret)
0502         goto err_server_handle_release;
0503 
0504     /* We need this ready before the service lookup is added */
0505     INIT_WORK(&ipa_qmi->init_driver_work, ipa_client_init_driver_work);
0506 
0507     ret = qmi_add_lookup(&ipa_qmi->client_handle, IPA_MODEM_SERVICE_SVC_ID,
0508                  IPA_MODEM_SVC_VERS, IPA_MODEM_SERVICE_INS_ID);
0509     if (ret)
0510         goto err_client_handle_release;
0511 
0512     return 0;
0513 
0514 err_client_handle_release:
0515     /* Releasing the handle also removes registered lookups */
0516     qmi_handle_release(&ipa_qmi->client_handle);
0517     memset(&ipa_qmi->client_handle, 0, sizeof(ipa_qmi->client_handle));
0518 err_server_handle_release:
0519     /* Releasing the handle also removes registered services */
0520     qmi_handle_release(&ipa_qmi->server_handle);
0521     memset(&ipa_qmi->server_handle, 0, sizeof(ipa_qmi->server_handle));
0522 
0523     return ret;
0524 }
0525 
0526 /* Tear down IPA QMI handles */
0527 void ipa_qmi_teardown(struct ipa *ipa)
0528 {
0529     cancel_work_sync(&ipa->qmi.init_driver_work);
0530 
0531     qmi_handle_release(&ipa->qmi.client_handle);
0532     memset(&ipa->qmi.client_handle, 0, sizeof(ipa->qmi.client_handle));
0533 
0534     qmi_handle_release(&ipa->qmi.server_handle);
0535     memset(&ipa->qmi.server_handle, 0, sizeof(ipa->qmi.server_handle));
0536 }