From patchwork Mon Oct 24 00:57:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Miguel Almeida X-Patchwork-Id: 13016474 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D011AC433FE for ; Mon, 24 Oct 2022 00:57:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229738AbiJXA5x (ORCPT ); Sun, 23 Oct 2022 20:57:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbiJXA5w (ORCPT ); Sun, 23 Oct 2022 20:57:52 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED330664D6; Sun, 23 Oct 2022 17:57:51 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id m14-20020a17090a3f8e00b00212dab39bcdso5160245pjc.0; Sun, 23 Oct 2022 17:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=RBbdDR1qIfFWCpyIS3gw2RrXMuQd+FyAZp7BhoIptWw=; b=TfEmQ5FkG7x5JVWSdQrIO7kb0R69TpMR/fvg6OYBSHscSA9xaBfnhT8ppaBNJgGEn+ 79xUr8P7YLN1DNjFnUpxV+Dl6V2GKbQS2mKxv8aRFV+1ImEwOFsgRm15PAwn+UsOMsyY hcKQKpSGl8hJsGpTRfVaGTkvhHoPdU2dkmUMRdS9jQWi9vfungHi15Yck1e00OG6tHdZ T2IEhgTowvYXT+U+qNEWUP8yZeUKQiBedMU6+JG7nU8Oyqmv/hhRVGejiRWK9sXseSuS 9a5Gg8lqPnDtpzNdTIowRYihe3rK3YarBfeAA/c6ibYdKr+qvrt4PE/gAlwP5AqinvS7 /aRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RBbdDR1qIfFWCpyIS3gw2RrXMuQd+FyAZp7BhoIptWw=; b=npllcqXoNE8LhkIvc3+N8nXgnObSTy57ZARmtsu63bZmnp4mAkk2NesCrjNvaoln4R XuQxMnELyE2GdWC4eBBwX1Lhyb2h+jDfbUDlyOz+qnRjQpd7BElrxOyXrJNOxNe1mSIP lfMQvKLCDd0PGnhbwlhcZMGnRRQwjhUdGoA1VkhjLWWAWeMvsvOaixG8fosn7NbEalzB kfv8Sm0GAiyUVzoQvYYREfc12sPY+4OJC/0fglxFF1YnRKFdjbDEiCKakL8CSy+T1foY 89ue1SyHzQfW1rwT3jR9gGf4s25XnUw2s8GeJOwiJGvSutf5SBhn5J8whyX8aoZ2ze4V 4HAw== X-Gm-Message-State: ACrzQf27ssuBUj1zmVt+GXklOkXVr0zyM5QNtSVrPQAvQsDQWAKqFKzv 9bCpb6l1cbEprTYL/H2DTo8= X-Google-Smtp-Source: AMsMyM4OpxA+GdWGSITBBcSmsb5WMO3k/s7ppi2dR0aT9zvC6QCviENvDIFS5HrQFOL6cPrBsTFc3Q== X-Received: by 2002:a17:90b:254a:b0:200:53f:891d with SMTP id nw10-20020a17090b254a00b00200053f891dmr35813118pjb.168.1666573071288; Sun, 23 Oct 2022 17:57:51 -0700 (PDT) Received: from mail.google.com (122-58-209-93-fibre.sparkbb.co.nz. [122.58.209.93]) by smtp.gmail.com with ESMTPSA id oj17-20020a17090b4d9100b00205d85cfb30sm3235486pjb.20.2022.10.23.17.57.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Oct 2022 17:57:50 -0700 (PDT) Date: Mon, 24 Oct 2022 13:57:42 +1300 From: Paulo Miguel Almeida To: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Jiri Kosina , Benjamin Tissoires Cc: linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, paulo.miguel.almeida.rodenas@gmail.com Subject: [PATCH] [next] HID: hyperv: remove unused struct synthhid_msg Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org struct synthhid_msg was meant to be a generic representation of the possible protocol messages sent through VMBus. In practice, only the header is read and depending on the message type, a cast to the actual type is done. Also, SYNTHHID_MAX_INPUT_REPORT_SIZE constant isn't used which I suspect is a leftover from the refactoring made while this driver was at the staging folder. This patch removes struct synthhid_msg and refactor the code accordingly. Signed-off-by: Paulo Miguel Almeida Reviewed-by: Michael Kelley --- drivers/hid/hid-hyperv.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c index 208cf8d981a5..0be717bb09d4 100644 --- a/drivers/hid/hid-hyperv.c +++ b/drivers/hid/hid-hyperv.c @@ -22,9 +22,6 @@ struct hv_input_dev_info { unsigned short reserved[11]; }; -/* The maximum size of a synthetic input message. */ -#define SYNTHHID_MAX_INPUT_REPORT_SIZE 16 - /* * Current version * @@ -59,11 +56,6 @@ struct synthhid_msg_hdr { u32 size; }; -struct synthhid_msg { - struct synthhid_msg_hdr header; - char data[]; /* Enclosed message */ -}; - union synthhid_version { struct { u16 minor_version; @@ -251,7 +243,7 @@ static void mousevsc_on_receive(struct hv_device *device, struct vmpacket_descriptor *packet) { struct pipe_prt_msg *pipe_msg; - struct synthhid_msg *hid_msg; + struct synthhid_msg_hdr *hid_msg_hdr; struct mousevsc_dev *input_dev = hv_get_drvdata(device); struct synthhid_input_report *input_report; size_t len; @@ -262,9 +254,9 @@ static void mousevsc_on_receive(struct hv_device *device, if (pipe_msg->type != PIPE_MESSAGE_DATA) return; - hid_msg = (struct synthhid_msg *)pipe_msg->data; + hid_msg_hdr = (struct synthhid_msg_hdr *)pipe_msg->data; - switch (hid_msg->header.type) { + switch (hid_msg_hdr->type) { case SYNTH_HID_PROTOCOL_RESPONSE: /* * While it will be impossible for us to protect against @@ -309,7 +301,7 @@ static void mousevsc_on_receive(struct hv_device *device, break; default: pr_err("unsupported hid msg type - type %d len %d\n", - hid_msg->header.type, hid_msg->header.size); + hid_msg_hdr->type, hid_msg_hdr->size); break; }