Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp131076ima; Sat, 20 Oct 2018 04:18:53 -0700 (PDT) X-Google-Smtp-Source: ACcGV626YmL7SQt0syfOpBGz17LQPbw4lr/9qLeaHFhmZ9ul8VNHQAOjZBsbMNJxgt1wuH3+Nt4y X-Received: by 2002:a62:5103:: with SMTP id f3-v6mr38088098pfb.107.1540034333666; Sat, 20 Oct 2018 04:18:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540034333; cv=none; d=google.com; s=arc-20160816; b=ZuMBOoCCynyclHVlxrg9SqTzOFqc97/f92/DAiSrn2SI7hI2Yx/kghNigSLHFNX243 47LyiZhxDrAUwOGPzAmOrF6Rxq7/rCNrWuLI5Ca6KcPSbdVxW6N8rESRceGq5RxGcG3g aeSXz60tmy3eypwxJzcEmuwWv0TVRx9fuoaZshcCdTwhvKOCWFZwsvr6NbPixzcOAze0 JbhU9wfaTOFv+7SPYomGqmsJEkYcPxMUK5RtPW2jOGErk7EGO29KdKEV+Limcovs8wLG 2+4rmMUspZIvnH6qSYbXV87i1d5SQ3QRD7orlrOG1zWXdrCX/PiBt2To8rIdWrwRxYa6 nnSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=8hlCNvZ/28psHN4d+dk92f51LGhmIVK65Y9zhDtQS0k=; b=HlBwtbr2eYWRwSCPNNcDOO1GgpmZU3Tfo92/iPfSZAtZA55nNclxemGTYdXenDgJcL XfyM8m9H9yipIFm6d7g0wNUlKOTUJX6LrJF8fuzeD4EA80zZZc7VAym3O/yrYEzryLR5 hxN6I7NOKyVmzMjXkKRQuxOc1ZGHdc/zoX0sZqp9upQLJQdajqDlJ2gkgarpn98AW+hV wn1NC3JvLtHKZP3ZXYO+dJ9QjjmmIee9hHqvmvthWDQ6JWI/OPqvdNmZrI0xOWFx0BoV CpN0p4r21KOz4OsLmOQDkyHnZz1KaMIrt+Bfb13oEXmzhPz9Q5meDfwREvrgBh9H1AFk pw5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ovKTnUEf; 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 y23-v6si26556030plp.371.2018.10.20.04.18.34; Sat, 20 Oct 2018 04:18:53 -0700 (PDT) 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=ovKTnUEf; 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 S1727364AbeJTT2S (ORCPT + 99 others); Sat, 20 Oct 2018 15:28:18 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:35350 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbeJTT2S (ORCPT ); Sat, 20 Oct 2018 15:28:18 -0400 Received: by mail-qt1-f196.google.com with SMTP id k3-v6so5387478qth.2; Sat, 20 Oct 2018 04:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8hlCNvZ/28psHN4d+dk92f51LGhmIVK65Y9zhDtQS0k=; b=ovKTnUEfNkdkCowwz2SZslgbV6hm7spraTzYMN4KdgUsAzylggfEmHDVFkLCseRG+o by7tLdJ5ozYExSKJOP9vszYUexGCM8y3SPp8/d+nrmHPrkX5v1vfriD+8T0zX0aSp34O 6vaS6C707Eri1Irm4VZWmwhdSlPrKeCxcKl3a3K3FNJ5PrIkzj+riCgx/FR7W2S+36zy Iur+ut3Nz180CXhPg1JAImS1maqpWFzI+WFAidKHP4jUDJk3mB+KdKg0Yomo2Q7kulCa M9a8F549ObAJuW06w4+bRIKHCGGocg0MMqYV+lhvZwj7lx5KSsjxoWxuug07ZEirlQZc rasA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8hlCNvZ/28psHN4d+dk92f51LGhmIVK65Y9zhDtQS0k=; b=oxtOT+D3N0sl8rPZ1g8GHzxtcFXQxqQ+Vg9TTgzdBXGBB8Muq92LWO+MOr78JGyRU/ 7a3n6gT/OB6aMG1hwxGdsRYlbNDIDYrcwS/2v/GG+MD8JITENXcySmTAzI9BmXLb8aR7 dumGOTgEPpWhJTfW5cqAdOpZqWgii78OUnJ+pMtstoYHYZpJePGV8Xz/wtNJiScTQtsL W8fUAJTmeTVjv1rLEdDFeQgRLDRQYKOrbzODJ0+NML2Ha25+aiuN8I7Kv7kvg24pY8vA rVUlav06K/Myb5R6/kZu6+Gm5lYLteoh1n6QKDj2euErCqioRJhgg0SCiRKLuuNZ6Fmv McHw== X-Gm-Message-State: ABuFfogES/5PzWyQtgUjK8NjqS/YdvXzIY8VQepquqkqRiVnaHiZyAIv R2hKLH6aWJ6pQ3m9o9hS5LythWvR/Hidq3cJuH4= X-Received: by 2002:ac8:6784:: with SMTP id b4-v6mr37022887qtp.373.1540034290304; Sat, 20 Oct 2018 04:18:10 -0700 (PDT) MIME-Version: 1.0 References: <20180421085009.28773-1-javier@emutex.com> <1539969334-24577-1-git-send-email-dan@emutex.com> <1539969334-24577-3-git-send-email-dan@emutex.com> In-Reply-To: <1539969334-24577-3-git-send-email-dan@emutex.com> From: Andy Shevchenko Date: Sat, 20 Oct 2018 14:17:58 +0300 Message-ID: Subject: Re: [PATCH v2 2/3] leds: upboard: Add LED support To: "Dan O'Donovan" Cc: Linux Kernel Mailing List , Andy Shevchenko , Mika Westerberg , "Krogerus, Heikki" , Lee Jones , Linus Walleij , Jacek Anaszewski , Pavel Machek , "open list:GPIO SUBSYSTEM" , Linux LED Subsystem , carlos.iglesias@emutex.com, Javier Arteaga Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 19, 2018 at 8:27 PM Dan O'Donovan wrote: > > From: Javier Arteaga > > Allow userspace to use the on-board LEDs as "upboard::". > +#include > +#include > +#include > +#include > +#include > +#include > +#include For better maintenance keep this ordered. > + adev = ACPI_COMPANION(dev); > + if (!adev || strcmp(acpi_device_hid(adev), "AANT0F01")) > + return -ENODEV; Why do you need this part? > + if (led_index >= ARRAY_SIZE(upboard_led_names)) > + return -EINVAL; > + if (!dev->parent) > + return -EINVAL; ...I think this check will cover cases when driver is being probed standalone. Otherwise it's caller's responsibility not to instantiate it if platform doesn't have this LED feature. > + regmap = dev_get_regmap(dev->parent, NULL); > + if (!regmap) > + return -EINVAL; -- With Best Regards, Andy Shevchenko