Received: by 10.223.185.116 with SMTP id b49csp316626wrg; Tue, 20 Feb 2018 21:59:38 -0800 (PST) X-Google-Smtp-Source: AH8x225pVUISkpXjy19AGhE0xzgeNjoiPXIptOHxiJawe4bVHud3lCF44QhaeE3ZH7tzZhrDurRt X-Received: by 2002:a17:902:57c7:: with SMTP id g7-v6mr2059865plj.381.1519192777955; Tue, 20 Feb 2018 21:59:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519192777; cv=none; d=google.com; s=arc-20160816; b=So0PTJ/U43K+PMtWNNj2/ZtdRdK1cV9se4dnTkwghjTkZVj+522KuQhhNcVo9jLe/h BYJhOJYbUXqGMt3RGwVqicJ03CQEB11w4QsAx3uzXD2L8WE0s25mvd0FU2T9NmU0xAtT NVeSOX0WfIXzYwYRdM+wbjAFcHtxBc653qSBJTm88oI1hdif0IY7d3MEuRyGMtrXPeRQ NsO02tRPzvNoGddkSxnpMbbxsHnLDFSVPPzhL0PXMuBcC1Zb4OyrzuCgL2xX0q7L3DXS 8SpTdqF+nyz0Fr1yMCMd8gO0FXqpX41z7SiytNg5cyOvS/USJZKW3/ZHCUiBdnX2b6Up pzOw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature :arc-authentication-results; bh=cEjhX2Iq0L5l5UrncSGMCPJJh3eSr1RCkXUxH5onDiA=; b=YHMerjX01qDqus9V/WoKLYw8b19oRnKYTsKwZBpL/d90Fv8ZrSiUrUt/eWuV9Pn1P5 v0L3cEphHbH0/sdOsTlruu1qgwmIuGTsPOgrSyc9o7GyMsE91hN2rxewU1VzDJArnYs5 v7IhADkxBjeLx14q6ROZzz15PxRhud7UiiYepoh8oCn0twN9JY/gtr8A31G2qFxGuEOr yLHGdfs2EJVcyGFX8iZSB+CZnzhe3l79JX1xR6bCQ71LibF0rVEa6wwE3n8fbsrbW5uu JeHBkRK71Wrx1LDxXutqDlerYbuig/w+4danLC9eklf66obQOLkJCvy7CpBUWtFPD/mb Hz8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QxGuaLGN; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si5963980pgr.235.2018.02.20.21.59.20; Tue, 20 Feb 2018 21:59:37 -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=@gmail.com header.s=20161025 header.b=QxGuaLGN; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751445AbeBUFcM (ORCPT + 99 others); Wed, 21 Feb 2018 00:32:12 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:36631 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751017AbeBUFcL (ORCPT ); Wed, 21 Feb 2018 00:32:11 -0500 Received: by mail-pl0-f65.google.com with SMTP id v3so380710plg.3; Tue, 20 Feb 2018 21:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=cEjhX2Iq0L5l5UrncSGMCPJJh3eSr1RCkXUxH5onDiA=; b=QxGuaLGNIv1NMz+aV6wAbMtmCxZVM2yEvrQJxu2+f0GuSJKOSLlAW6skymf3uXFahS zXlfQFWBfYlY96UsFi8p/kuTyVHvtUjvdRtJTD4QO8vVWYCAZeC0aaaAVEbKJqxzvNk7 vb43WgIWfmAhMb+ieJYzd0kgKn5YCp6QZtQJZD1/ujnsWCCzvM4j3mQbh0dizxGSZBOL exykdfr/rQQBaiVj5Tw1JG+ZfF8mjxoRa0O98CmW3Z2B9ObDDdcpOTpMoksmC78TYzvk hPQwjRPfTaxQNxrOuH1fJN75q0xtZtuvYIA3E7WhwBEVLqEFfeNK/wBproyO26kY71uB xFfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cEjhX2Iq0L5l5UrncSGMCPJJh3eSr1RCkXUxH5onDiA=; b=dQ23H3FFWZwi0k3UXU6Qq7EjUPSJOzh5o1Mbq2ZoNREbT/QQUvyVoaFRID/4/KKRUn uPg4GJewsYwklrTH7Anvq+vwMlpse/NHT431HO/GfOI2hwjM/fDrmQSF5r7sPxw/sBaV mEquIFrxrDVu36YyjsmD4VV76+u4A/j/20443WJlb9d80t/7Sd5jKWg7KP8KbPUOJYDz li6wIBmVTUCgk2Y4LrNnosJvWaPDrU8VuK1sRSA9/MhrLspBjNedcVOES6Z7wrv4ysUp qV6TIxpOAAygbPAGVGfLnoHRcyhS459jRG6o3xP8AlNSmh76j2jlIhuwDK0lmyZ5PLzS itNA== X-Gm-Message-State: APf1xPDWgDBILJgfCp44OF1dUEJLlxhS8bsdpbLiuXM1S95XkJ7piX6j yIJRVczIjE6kDm6BfJRPXORwL9Yd X-Received: by 2002:a17:902:d20a:: with SMTP id t10-v6mr2010062ply.257.1519191129767; Tue, 20 Feb 2018 21:32:09 -0800 (PST) Received: from ?IPv6:2604:4080:1012:80b0:6245:cbff:fe9b:2853? ([2604:4080:1012:80b0:6245:cbff:fe9b:2853]) by smtp.gmail.com with ESMTPSA id v8sm13276347pff.38.2018.02.20.21.32.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2018 21:32:08 -0800 (PST) Subject: Re: [PATCH v2 1/3] HID: add driver for Valve Steam Controller To: Rodrigo Rivas Costa , Jiri Kosina , Benjamin Tissoires , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org References: <20180220193306.28748-1-rodrigorivascosta@gmail.com> <20180220193306.28748-2-rodrigorivascosta@gmail.com> From: Cameron Gutman Message-ID: Date: Tue, 20 Feb 2018 21:32:08 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180220193306.28748-2-rodrigorivascosta@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/20/2018 11:33 AM, Rodrigo Rivas Costa wrote: > +static void steam_work_connect_cb(struct work_struct *work) > +{ > + struct steam_device *steam = container_of(work, struct steam_device, > + work_connect); > + unsigned long flags; > + bool connected; > + int ret; > + > + spin_lock_irqsave(&steam->lock, flags); > + connected = steam->connected; > + spin_unlock_irqrestore(&steam->lock, flags); > + > + if (connected) { > + if (steam->input) { > + dbg_hid("%s: already connected\n", __func__); > + return; > + } > + ret = steam_register(steam); > + if (ret) { > + hid_err(steam->hdev, > + "%s:steam_register failed with error %d\n", > + __func__, ret); > + return; > + } > + } else { > + steam_unregister(steam); I think you need synchronization here. You don't want to be in the middle of processing a HID event or power supply update and have your device freed out from underneath you. xpad uses RCU to avoid this race. > + } > +} > + Regards, Cameron