From patchwork Thu Mar 8 08:00:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 130978 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp6177766lja; Thu, 8 Mar 2018 00:05:13 -0800 (PST) X-Google-Smtp-Source: AG47ELtYnqyA9P8I4XAcMZkvVFDSBQRKSGssKfs0iFyGHNv4IXT6y8YgOQ8SmcyIzinbQ1FUabyu X-Received: by 2002:a17:902:ab91:: with SMTP id f17-v6mr12885397plr.114.1520496313056; Thu, 08 Mar 2018 00:05:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520496313; cv=none; d=google.com; s=arc-20160816; b=CiotJvx2M3/EuBnIc+UWC6a2ZP8mxh8C6SaiquiURYuUSbwAteP3Mu1RdxKMm676U0 2XABwBqqrMGOk40oQOM/O62ek7NZQecEtaox5/0Md+9M44hlHqhiM7uoQV0ypjZipqHM 7gqFCevoFTcpbD8UDwPc+ayvJPDh+iA5D6Z/MhtgSM0nZBruOMaD2UUGAOBB9xbMGTbW kgx0EDyIw2+IUEiJhlzwHyU71dDc3JeSVEot6EkItGoPqTit5vFTDfp6L5020viCJnI5 w5VuCbLD7Tm6fwnuwaSnx4Tfj0rOXnTX748vQ/9mmQ1tqTmXUV0MA3o9JzMRX/pmLnJ7 5imw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=obciHh3d5Hc4X+duCPF5C7EdnBElRJnu5alRW+0c53s=; b=VOxJ21D9ak1VlFwTpNOy43HWwb/jsadzRbZfeMqK6RiTkqs/og0MTlpDobn8A2j2X6 L1Wh4Nge8ajJMGTtBUkbRM9lRJbAvNvbIFlYDKQEOp4g/EjBkXCB8lFdieDVd2tzKsfk XZ8t/94T1Vpa+WuApFV33eGsYJ7JVx5D0+oc3ye4xMa2FVUjYvrC4nwRguHsJpBW6JLh oUBQfA9bsfhkRyldYCOFqm/d1An7fFlqX85yjgPiLVsmlepLlERPmnGd9taB7YH03Z2X TsytgFGWJOXcu0Si8TNA8atf0wKY8insofqiDlidTp66reunus/bikbn1wgcS0zZBz82 ScvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PD53cVkF; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8-v6si14513041plh.219.2018.03.08.00.05.12; Thu, 08 Mar 2018 00:05:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PD53cVkF; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935525AbeCHIB5 (ORCPT + 2 others); Thu, 8 Mar 2018 03:01:57 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:32825 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964971AbeCHIB4 (ORCPT ); Thu, 8 Mar 2018 03:01:56 -0500 Received: by mail-wm0-f68.google.com with SMTP id s206so26129687wme.0 for ; Thu, 08 Mar 2018 00:01:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MO+bfvGDZOQjAlt1G5SDVIXTGY7SP8MqWMcb+HyUtwA=; b=PD53cVkFikR/fBSKcXHztM05EquYHeOTozzou3OroK4X0TH16XcD7GVii7QRrCyU0s +VKYCvDsot6h4rcHfSw+ZWUTtwuAmd8TXUXazm+LQ0I+f+yiVLgPpCd8TX8gRSqh4pAd gppEtAtPNFL2SOP/gvf3Ywihay+ODJ/ywBl8g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MO+bfvGDZOQjAlt1G5SDVIXTGY7SP8MqWMcb+HyUtwA=; b=Qi0zi4tEE5cDDqKfVf0Le9y9uJ7ceGGsmnnCQQ4kH98+aywjPsdAI/rPgV9YvbKTG+ Wz6UDcPM8yMpv8PRQC0cAoZHCik30CJDK71hG9Vt5kgH6RrFgmC4dvDi/4pRd2bLjD2v TVzLe9ufPua9oSMTLTWdWCAewr83qKf/raFHecHoeGeQvS0o+oNlfQDvAc4w+ls20RSq BebMWIUHutPoP65aPj/Lk8du4cCg05Iyqd1wuMaGG5wnIERllhrR+S3p0UtiOAR4OS93 6DMtNnjIkj+z5Y+aTJ/ggj/JCOTx7gmeWTebA+51FCYMd7AwdrzKSICWd41s180QAxxQ orDA== X-Gm-Message-State: AElRT7HM/XiARMShnbFu21IxohT32WWuFlOpeFn9DwMzzEb1Y5Va3n09 nwNjkLK8b4LrW/bpO8IaemaPPOOFgrE= X-Received: by 10.28.35.14 with SMTP id j14mr15097861wmj.43.1520496115187; Thu, 08 Mar 2018 00:01:55 -0800 (PST) Received: from localhost.localdomain ([160.89.73.46]) by smtp.gmail.com with ESMTPSA id e191sm11223361wmg.12.2018.03.08.00.01.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Mar 2018 00:01:54 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Andy Shevchenko , Ard Biesheuvel , linux-kernel@vger.kernel.org Subject: [PATCH 02/12] efi/apple-properties: Device core takes care of empty properties Date: Thu, 8 Mar 2018 08:00:10 +0000 Message-Id: <20180308080020.22828-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180308080020.22828-1-ard.biesheuvel@linaro.org> References: <20180308080020.22828-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: Andy Shevchenko There is no need to artificially supply a property length and fake data if property has type of boolean. Remove redundant piece of data and code. Signed-off-by: Andy Shevchenko Reviewed-and-tested-by: Lukas Wunner Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/apple-properties.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) -- 2.15.1 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/firmware/efi/apple-properties.c b/drivers/firmware/efi/apple-properties.c index 9f6bcf173b0e..b9602e0d7b50 100644 --- a/drivers/firmware/efi/apple-properties.c +++ b/drivers/firmware/efi/apple-properties.c @@ -52,8 +52,6 @@ struct properties_header { struct dev_header dev_header[0]; }; -static u8 one __initdata = 1; - static void __init unmarshal_key_value_pairs(struct dev_header *dev_header, struct device *dev, void *ptr, struct property_entry entry[]) @@ -95,14 +93,9 @@ static void __init unmarshal_key_value_pairs(struct dev_header *dev_header, key_len - sizeof(key_len)); entry[i].name = key; - entry[i].is_array = true; entry[i].length = val_len - sizeof(val_len); + entry[i].is_array = !!entry[i].length; entry[i].pointer.raw_data = ptr + key_len + sizeof(val_len); - if (!entry[i].length) { - /* driver core doesn't accept empty properties */ - entry[i].length = 1; - entry[i].pointer.raw_data = &one; - } if (dump_properties) { dev_info(dev, "property: %s\n", entry[i].name);