Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2171622ybl; Thu, 30 Jan 2020 12:38:14 -0800 (PST) X-Google-Smtp-Source: APXvYqz022cITyPB44pWqFNlT2hjx3RNOEnRLHo75O9zFKdAtyiNKyAYSgu0xy3LqiIPHHcl7fKs X-Received: by 2002:aca:c646:: with SMTP id w67mr4048385oif.171.1580416693952; Thu, 30 Jan 2020 12:38:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580416693; cv=none; d=google.com; s=arc-20160816; b=oIYcOAKrWfRcaxZoCTRVWN4x4znWr78vgMbAzju8B5Y7Z4Gd4w7ARUWJT5M8ouwPu3 bpD2JgHRHt3Bgw/GjU7bs8k7IKDRstSPxLXMkC1spbEa3lmPHCSksoodR10xcPPtJn50 ylib5S09uBsQX4qItbaBfFmdK0K4k+5MV8gbzDr5QlhySpZIhruvrpyoYtf+pKlj/Vye V2MujFaFQcyh8FXAJfLIzEzwgmbp30TrqktKVWDwyy9eynQ8EYNzENXxPMood80MNFoA qs1iDFKW4xEwJuxpkRbc7zsq2Hl03y22TZu1dHhAOX2gFrvb9qEuoizCmG2v1FoRE3Sh RTJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bm4YzehtYvCtm+QPiWtk/5LZt32vGs8W5AoWJFGUkv8=; b=08yZnn18ioPag8QSSWIypIZg6TwnzZQ7V5UykEgKucfV61GsXRMAufoXGP+Bu3AgFv 5376Re6M5QIrIsv2JqBZxs9AR0A8JySc3eN2w31IABTGGIx4dRD3akLwvUIXQajnM/YU vOa9Sute92Z+ikXL4Z2LvKddNfLXcPheIn6KsWMd7qoyIoWDQdaKzsBkXEmt767Gj/i5 1tR9vBmvBtNgU4jylJEzt6n42ti89LpBrtTfM2CIHgthfhEs0qsE5T7hSPXnlx54nkmf oipKBErQYnQz1YCnnUJ4XLyqFr1ESGdPwxAEfiEkeOAhP5dVn76Sm4RGSCFi6YwzADbK fFKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YcXTlLf9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si3696452otn.53.2020.01.30.12.38.01; Thu, 30 Jan 2020 12:38:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YcXTlLf9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727795AbgA3UgI (ORCPT + 99 others); Thu, 30 Jan 2020 15:36:08 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:39288 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727485AbgA3UgH (ORCPT ); Thu, 30 Jan 2020 15:36:07 -0500 Received: by mail-pl1-f196.google.com with SMTP id g6so1787095plp.6 for ; Thu, 30 Jan 2020 12:36:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bm4YzehtYvCtm+QPiWtk/5LZt32vGs8W5AoWJFGUkv8=; b=YcXTlLf9EK4kMX7y9+Kv2Enpr4KpPX5XdXR9xzNVpzvCS1ierMjfJnPEmcISwf62bz 49UOpx1dWtAl9LVw9AX0rd8G5oRfzTfnEsWeG1Ty800rno3rEvAyLklxJrOYR26sOnYt gNHKae6iWSy6+Lb92c+z9407B80Pxt8wm6snI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bm4YzehtYvCtm+QPiWtk/5LZt32vGs8W5AoWJFGUkv8=; b=Vso5iYJRZVl72MQDCkkgnsZOzgCUfftr9/H7jDLJlw5FwOzc3S9HUZMgBEiRy40+Vs Tdne8SlRi8WrsHD94GTBMuOOnGDXncp1i0arY8kQk0ueF8WH6Tgz+pgX7PN/7Cjj1tSL afnvHzAKUsd9gSvYJKXwl4oEvThIdcQN1+FGSczipBr+tkIsbi9x6ZV1ezMi5J9D2OPp uQVUK6s0MxE/GE/LqeC7poT/N48pWpikA7XhTCp5cM09RgS5VsAZlzB+yehdP84klAuv YEDos5hk/2RIIKsy8P6d8VN2jBvMRoIM8oCrYmEnn6gkHYKiEtoJltr26YHQqRPEDW3i JR0w== X-Gm-Message-State: APjAAAV4igGR57j+RVgAr5u8oy0lF1HCrYLx0tMB4P8YQWMrhRGSR9so HpylZ2SbDCn0/u8Smna+wbzUAeY4dMWNgQ== X-Received: by 2002:a17:90a:a60c:: with SMTP id c12mr8244503pjq.28.1580416566898; Thu, 30 Jan 2020 12:36:06 -0800 (PST) Received: from pmalani2.mtv.corp.google.com ([2620:15c:202:201:172e:4646:c089:ce59]) by smtp.gmail.com with ESMTPSA id q12sm7469321pfh.158.2020.01.30.12.36.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jan 2020 12:36:06 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: Prashant Malani , Mauro Carvalho Chehab , Benson Leung , Enric Balletbo i Serra , Guenter Roeck , Hans Verkuil , Neil Armstrong , Gwendal Grignou , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)) Subject: [PATCH 15/17] media: cros-ec-cec: Use cros_ec_send_cmd_msg() Date: Thu, 30 Jan 2020 12:31:06 -0800 Message-Id: <20200130203106.201894-16-pmalani@chromium.org> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog In-Reply-To: <20200130203106.201894-1-pmalani@chromium.org> References: <20200130203106.201894-1-pmalani@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace cros_ec_cmd_xfer_status() with cros_ec_send_cmd_msg() which does the message buffer setup and cleanup, but is located in platform/chrome and used by other drivers. Signed-off-by: Prashant Malani --- .../media/platform/cros-ec-cec/cros-ec-cec.c | 39 +++++++------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c index f048e89947850e..0ee7354dca9724 100644 --- a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c +++ b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c @@ -94,18 +94,14 @@ static int cros_ec_cec_set_log_addr(struct cec_adapter *adap, u8 logical_addr) { struct cros_ec_cec *cros_ec_cec = adap->priv; struct cros_ec_device *cros_ec = cros_ec_cec->cros_ec; - struct { - struct cros_ec_command msg; - struct ec_params_cec_set data; - } __packed msg = {}; + struct ec_params_cec_set data; int ret; - msg.msg.command = EC_CMD_CEC_SET; - msg.msg.outsize = sizeof(msg.data); - msg.data.cmd = CEC_CMD_LOGICAL_ADDRESS; - msg.data.val = logical_addr; + data.cmd = CEC_CMD_LOGICAL_ADDRESS; + data.val = logical_addr; - ret = cros_ec_cmd_xfer_status(cros_ec, &msg.msg); + ret = cros_ec_send_cmd_msg(cros_ec, 0, EC_CMD_CEC_SET, &data, + sizeof(data), NULL, 0); if (ret < 0) { dev_err(cros_ec->dev, "error setting CEC logical address on EC: %d\n", ret); @@ -120,17 +116,14 @@ static int cros_ec_cec_transmit(struct cec_adapter *adap, u8 attempts, { struct cros_ec_cec *cros_ec_cec = adap->priv; struct cros_ec_device *cros_ec = cros_ec_cec->cros_ec; - struct { - struct cros_ec_command msg; - struct ec_params_cec_write data; - } __packed msg = {}; + struct ec_params_cec_write data = {}; int ret; - msg.msg.command = EC_CMD_CEC_WRITE_MSG; msg.msg.outsize = cec_msg->len; - memcpy(msg.data.msg, cec_msg->msg, cec_msg->len); + memcpy(data.msg, cec_msg->msg, cec_msg->len); - ret = cros_ec_cmd_xfer_status(cros_ec, &msg.msg); + ret = cros_ec_send_cmd_msg(cros_ec, 0, EC_CMD_CEC_WRITE_MSG, + &data, sizeof(cec_msg->len), NULL, 0); if (ret < 0) { dev_err(cros_ec->dev, "error writing CEC msg on EC: %d\n", ret); @@ -144,18 +137,14 @@ static int cros_ec_cec_adap_enable(struct cec_adapter *adap, bool enable) { struct cros_ec_cec *cros_ec_cec = adap->priv; struct cros_ec_device *cros_ec = cros_ec_cec->cros_ec; - struct { - struct cros_ec_command msg; - struct ec_params_cec_set data; - } __packed msg = {}; + struct ec_params_cec_set data = {0}; int ret; - msg.msg.command = EC_CMD_CEC_SET; - msg.msg.outsize = sizeof(msg.data); - msg.data.cmd = CEC_CMD_ENABLE; - msg.data.val = enable; + data.cmd = CEC_CMD_ENABLE; + data.val = enable; - ret = cros_ec_cmd_xfer_status(cros_ec, &msg.msg); + ret = cros_ec_send_cmd_msg(cros_ec, 0, EC_CMD_CEC_SET, &data, + sizeof(data), NULL, 0); if (ret < 0) { dev_err(cros_ec->dev, "error %sabling CEC on EC: %d\n", -- 2.25.0.341.g760bfbb309-goog