From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CCBBC433DB for ; Thu, 7 Jan 2021 17:56:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DADB9233FD for ; Thu, 7 Jan 2021 17:56:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727061AbhAGR4C (ORCPT ); Thu, 7 Jan 2021 12:56:02 -0500 Received: from mail2.protonmail.ch ([185.70.40.22]:63296 "EHLO mail2.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727058AbhAGR4C (ORCPT ); Thu, 7 Jan 2021 12:56:02 -0500 Date: Thu, 07 Jan 2021 17:55:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1610042119; bh=mwXdoxJJLMFi9/FznGQx5flWs07lXINV7WgK0geB2ac=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=f49o2XVYcmKqs4HSMwe6Pe2rOsqqjKeOCquqKUlbF/kXvHWnFpnQvQTTn0L5Nyymo thdwu6SfGBCUHkcSm8Rz4XuOan47VRvHnFlCftcZZBjrzeseaGGnegCPZqm8j5vu8c XDWEbuasJVOmFHgIPVVHSRlDMMLLdgu8XYv27QwQ= To: Roderick Colenbrander From: =?utf-8?Q?Barnab=C3=A1s_P=C5=91cze?= Cc: Jiri Kosina , Benjamin Tissoires , "linux-input@vger.kernel.org" , Chris Ye , Roderick Colenbrander Reply-To: =?utf-8?Q?Barnab=C3=A1s_P=C5=91cze?= Subject: Re: [PATCH v2 04/13] HID: playstation: add DualSense touchpad support. Message-ID: In-Reply-To: <20210102223109.996781-5-roderick@gaikai.com> References: <20210102223109.996781-1-roderick@gaikai.com> <20210102223109.996781-5-roderick@gaikai.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Hi 2021. janu=C3=A1r 2., szombat 23:31 keltez=C3=A9ssel, Roderick Colenbrander= =C3=ADrta: > From: Roderick Colenbrander > > Implement support for DualSense touchpad as a separate input device. > > Signed-off-by: Roderick Colenbrander > [...] > +static struct input_dev *ps_touchpad_create(struct hid_device *hdev, int= width, int height, > +=09=09unsigned int num_contacts) > +{ > +=09struct input_dev *touchpad; > +=09int ret; > + > +=09touchpad =3D ps_allocate_input_dev(hdev, "Touchpad"); > +=09if (IS_ERR(touchpad)) > +=09=09return ERR_PTR(-ENOMEM); I know that at the moment ENOMEM is the only possible error, but I believe `return ERR_CAST(touchpad);` would be better. (Or even just `return touchpa= d;`.) > + > +=09/* Map button underneath touchpad to BTN_LEFT. */ > +=09input_set_capability(touchpad, EV_KEY, BTN_LEFT); > +=09__set_bit(INPUT_PROP_BUTTONPAD, touchpad->propbit); > + > +=09input_set_abs_params(touchpad, ABS_MT_POSITION_X, 0, width - 1, 0, 0)= ; > +=09input_set_abs_params(touchpad, ABS_MT_POSITION_Y, 0, height - 1, 0, 0= ); > + > +=09ret =3D input_mt_init_slots(touchpad, num_contacts, INPUT_MT_POINTER)= ; > +=09if (ret) > +=09=09return ERR_PTR(ret); > + > +=09ret =3D input_register_device(touchpad); > +=09if (ret) > +=09=09return ERR_PTR(ret); > + > +=09return touchpad; > +} > [...]