From patchwork Thu Jan 25 04:36:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "sandeep.cs" X-Patchwork-Id: 767056 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 772AF10A0E for ; Thu, 25 Jan 2024 04:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706157432; cv=none; b=YCGUStsUkIbC4eDjRbuT5mE92vk0VN0rJB72VQTGs1Fnn87JooTkSemUyw9Do/PfKBURxNnvjc91NuPayXVjUaivEV0+3Bq0MEWl+DGMfep/mA9j7P7xlu/2iqUNla8mcUCpSATW24Atqh5eNSye8+U2/G42mfoPs9e4GI7AYvQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706157432; c=relaxed/simple; bh=rmEWhlVDpeIv0NBvUoVUkcUuNtoCG83x6jLTykAx0mI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=Hot6/+8VNZXCK29xz6T6kcu2uDy1YSg7P6Fch3QwJtMdr4RD2Iiw8lnlMVPRtRiw1nYumeAicf25UPUllonY6erEBTG8+6RL83/C7dOWLJKP9Ie8M3PvNLeGJ/+szaUcAr20nluMUDOG3uQkH54umPC13qGbBV4wtAEn6IYw4dQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=FnQmKy8X; arc=none smtp.client-ip=203.254.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="FnQmKy8X" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20240125043705epoutp048a23de5c52b9a0bd9cab961a6b501a3b~tfSNy2fIj1017710177epoutp04V for ; Thu, 25 Jan 2024 04:37:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20240125043705epoutp048a23de5c52b9a0bd9cab961a6b501a3b~tfSNy2fIj1017710177epoutp04V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1706157425; bh=KW0GPlc8JiP+I2GAgypKX/jwr3P9ZdZ55AOnVvit4IE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FnQmKy8X2fB2W9KnM9z43KKEIYAyNKSnd30fzG2rhtcKVcUXHmCg2MHvYjpE1ONy7 QSBij66y7d61n2kGDauPTp5SeqdDQ1g6x7l46Hocz3ErXNUAG6OYYfEjlMcNclZ+FU bihsuo+BENsFTotUO02RzV+1hBjTJUWT/Tx7gqCU= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20240125043704epcas5p4860f2846d3f44b15c3d426a8fe32fe67~tfSNfEfVB2513325133epcas5p4E; Thu, 25 Jan 2024 04:37:04 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.180]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4TL7Mg0Y0Qz4x9Q8; Thu, 25 Jan 2024 04:37:03 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 93.C6.09634.E65E1B56; Thu, 25 Jan 2024 13:37:02 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20240125043702epcas5p33d9ef989dc51276185972d4517ba80fd~tfSLl3TTk0575905759epcas5p3Z; Thu, 25 Jan 2024 04:37:02 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240125043702epsmtrp10f457bf9d1f2c4998f7b9d6a583b78cf~tfSLkXaOM1583815838epsmtrp1U; Thu, 25 Jan 2024 04:37:02 +0000 (GMT) X-AuditID: b6c32a49-eebff700000025a2-4e-65b1e56ea263 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 1B.DB.18939.E65E1B56; Thu, 25 Jan 2024 13:37:02 +0900 (KST) Received: from ws2030077324.sa.corp.samsungelectronics.net (unknown [107.99.237.91]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240125043701epsmtip2c0ee6edc7c3236fb782a9d45485830e1~tfSKG6JX12197421974epsmtip2r; Thu, 25 Jan 2024 04:37:00 +0000 (GMT) From: Sandeep C S To: Jiri Kosina , Benjamin Tissoires Cc: gaudium.lee@samsung.com, ih0923.kim@samsung.com, suhyun_.kim@samsung.com, jitender.s21@samsung.com, junwan.cho@samsung.com, sandeep.cs@samsung.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [HID Patchsets for Samsung driver v4 2/6] HID: Samsung : Fix the checkpatch complain. Rewritten code using memcmp where applicable. Date: Thu, 25 Jan 2024 10:06:25 +0530 Message-Id: <20240125043630.4031634-3-sandeep.cs@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240125043630.4031634-1-sandeep.cs@samsung.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnk+LIzCtJLcpLzFFi42LZdlhT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1uB7OMbZaBlHO3EktxRqKhFnNR cSIATNyjseACAAA= X-CMS-MailID: 20240125043702epcas5p33d9ef989dc51276185972d4517ba80fd X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240125043702epcas5p33d9ef989dc51276185972d4517ba80fd References: <20240125043630.4031634-1-sandeep.cs@samsung.com> Resolved warnings found by checkpatch.pl script. Signed-off-by: Sandeep C S Signed-off-by: Junwan Cho Signed-off-by: Jitender Sajwan --- drivers/hid/hid-samsung.c | 80 +++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/drivers/hid/hid-samsung.c b/drivers/hid/hid-samsung.c index 3a8756232731..97d0bf7d4d7e 100644 --- a/drivers/hid/hid-samsung.c +++ b/drivers/hid/hid-samsung.c @@ -58,33 +58,25 @@ static inline void samsung_irda_dev_trace(struct hid_device *hdev, static __u8 *samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) { - if (*rsize == 184 && rdesc[175] == 0x25 && rdesc[176] == 0x40 && - rdesc[177] == 0x75 && rdesc[178] == 0x30 && - rdesc[179] == 0x95 && rdesc[180] == 0x01 && + if (*rsize == 184 && !memcmp(&rdesc[175], "\x25\x40\x75\x30\x95\x01", 6) && rdesc[182] == 0x40) { samsung_irda_dev_trace(hdev, 184); rdesc[176] = 0xff; rdesc[178] = 0x08; rdesc[180] = 0x06; rdesc[182] = 0x42; - } else - if (*rsize == 203 && rdesc[192] == 0x15 && rdesc[193] == 0x0 && - rdesc[194] == 0x25 && rdesc[195] == 0x12) { + } else if (*rsize == 203 && !memcmp(&rdesc[192], "\x15\x00\x25\x12", 4)) { samsung_irda_dev_trace(hdev, 203); - rdesc[193] = 0x1; - rdesc[195] = 0xf; - } else - if (*rsize == 135 && rdesc[124] == 0x15 && rdesc[125] == 0x0 && - rdesc[126] == 0x25 && rdesc[127] == 0x11) { + rdesc[193] = 0x01; + rdesc[195] = 0x0f; + } else if (*rsize == 135 && !memcmp(&rdesc[124], "\x15\x00\x25\x11", 4)) { samsung_irda_dev_trace(hdev, 135); - rdesc[125] = 0x1; - rdesc[127] = 0xe; - } else - if (*rsize == 171 && rdesc[160] == 0x15 && rdesc[161] == 0x0 && - rdesc[162] == 0x25 && rdesc[163] == 0x01) { + rdesc[125] = 0x01; + rdesc[127] = 0x0e; + } else if (*rsize == 171 && !memcmp(&rdesc[160], "\x15\x00\x25\x01", 4)) { samsung_irda_dev_trace(hdev, 171); - rdesc[161] = 0x1; - rdesc[163] = 0x3; + rdesc[161] = 0x01; + rdesc[163] = 0x03; } return rdesc; } @@ -99,7 +91,7 @@ static int samsung_kbd_mouse_input_mapping(struct hid_device *hdev, struct usb_interface *intf = to_usb_interface(hdev->dev.parent); unsigned short ifnum = intf->cur_altsetting->desc.bInterfaceNumber; - if (1 != ifnum || HID_UP_CONSUMER != (usage->hid & HID_USAGE_PAGE)) + if (ifnum != 1 || HID_UP_CONSUMER != (usage->hid & HID_USAGE_PAGE)) return 0; dbg_hid("samsung wireless keyboard/mouse input mapping event [0x%x]\n", @@ -107,17 +99,39 @@ static int samsung_kbd_mouse_input_mapping(struct hid_device *hdev, switch (usage->hid & HID_USAGE) { /* report 2 */ - case 0x183: samsung_kbd_mouse_map_key_clear(KEY_MEDIA); break; - case 0x195: samsung_kbd_mouse_map_key_clear(KEY_EMAIL); break; - case 0x196: samsung_kbd_mouse_map_key_clear(KEY_CALC); break; - case 0x197: samsung_kbd_mouse_map_key_clear(KEY_COMPUTER); break; - case 0x22b: samsung_kbd_mouse_map_key_clear(KEY_SEARCH); break; - case 0x22c: samsung_kbd_mouse_map_key_clear(KEY_WWW); break; - case 0x22d: samsung_kbd_mouse_map_key_clear(KEY_BACK); break; - case 0x22e: samsung_kbd_mouse_map_key_clear(KEY_FORWARD); break; - case 0x22f: samsung_kbd_mouse_map_key_clear(KEY_FAVORITES); break; - case 0x230: samsung_kbd_mouse_map_key_clear(KEY_REFRESH); break; - case 0x231: samsung_kbd_mouse_map_key_clear(KEY_STOP); break; + case 0x183: + samsung_kbd_mouse_map_key_clear(KEY_MEDIA); + break; + case 0x195: + samsung_kbd_mouse_map_key_clear(KEY_EMAIL); + break; + case 0x196: + samsung_kbd_mouse_map_key_clear(KEY_CALC); + break; + case 0x197: + samsung_kbd_mouse_map_key_clear(KEY_COMPUTER); + break; + case 0x22b: + samsung_kbd_mouse_map_key_clear(KEY_SEARCH); + break; + case 0x22c: + samsung_kbd_mouse_map_key_clear(KEY_WWW); + break; + case 0x22d: + samsung_kbd_mouse_map_key_clear(KEY_BACK); + break; + case 0x22e: + samsung_kbd_mouse_map_key_clear(KEY_FORWARD); + break; + case 0x22f: + samsung_kbd_mouse_map_key_clear(KEY_FAVORITES); + break; + case 0x230: + samsung_kbd_mouse_map_key_clear(KEY_REFRESH); + break; + case 0x231: + samsung_kbd_mouse_map_key_clear(KEY_STOP); + break; default: return 0; } @@ -128,7 +142,7 @@ static int samsung_kbd_mouse_input_mapping(struct hid_device *hdev, static __u8 *samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) { - if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev->product && hid_is_usb(hdev)) + if (hdev->product == USB_DEVICE_ID_SAMSUNG_IR_REMOTE && hid_is_usb(hdev)) rdesc = samsung_irda_report_fixup(hdev, rdesc, rsize); return rdesc; } @@ -139,7 +153,7 @@ static int samsung_input_mapping(struct hid_device *hdev, struct hid_input *hi, { int ret = 0; - if (USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE == hdev->product && hid_is_usb(hdev)) + if (hdev->product == USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE && hid_is_usb(hdev)) ret = samsung_kbd_mouse_input_mapping(hdev, hi, field, usage, bit, max); @@ -158,7 +172,7 @@ static int samsung_probe(struct hid_device *hdev, goto err_free; } - if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev->product) { + if (hdev->product == USB_DEVICE_ID_SAMSUNG_IR_REMOTE) { if (!hid_is_usb(hdev)) { ret = -EINVAL; goto err_free;