From patchwork Thu Sep 17 13:45:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 53819 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id A9CDD22A0D for ; Thu, 17 Sep 2015 13:47:38 +0000 (UTC) Received: by lbot4 with SMTP id t4sf6542189lbo.0 for ; Thu, 17 Sep 2015 06:47:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=5jvrzlDSeRb1n7mxUioSyfuyOT+SPEIa7yQhwFieVfQ=; b=L3iyVLLtlVVu180jMGzSFuqVCV1MXRzwOQG7/HC8lQlyKf6P6jRKUc7/kynvnoZ/qN a0/ScbWdlDwQ/7Ysh9SeAnnsOlpV9I+LCLHU1YxKXwUgZVcgoG+HKfAFphfN2gF//kQl c0j4kQ6PiODuwsihCniKpYVU0ueogzb4xYYgp5l8pgC0SfruVALXPR/1TEB9OROm+c6+ LJW1ydljBO8lOoZKLlHRHVDoZ+YfaJeJulF6tT/dZHChqoC268dCGv+i+IY/dnV76A76 0mtiFZOWXEYQnktko9YkOYkga/TwES/wMlMFm+bFNOf2jdmICLgHLb9lBUY6XY2dFWbQ 1cQA== X-Gm-Message-State: ALoCoQmuHt3OV83qyoN7V6cLEe8leuNDR9DL/2kQ41iFuq/cvAQxangkFH8fWFr7HlRevM+Hs2C2 X-Received: by 10.112.57.194 with SMTP id k2mr6548637lbq.10.1442497657630; Thu, 17 Sep 2015 06:47:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.229 with SMTP id z5ls92707lal.8.gmail; Thu, 17 Sep 2015 06:47:37 -0700 (PDT) X-Received: by 10.152.21.129 with SMTP id v1mr19633132lae.87.1442497657431; Thu, 17 Sep 2015 06:47:37 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id xf5si699486lbb.93.2015.09.17.06.47.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2015 06:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by lanb10 with SMTP id b10so11467091lan.3 for ; Thu, 17 Sep 2015 06:47:37 -0700 (PDT) X-Received: by 10.152.21.196 with SMTP id x4mr31092169lae.86.1442497657234; Thu, 17 Sep 2015 06:47:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp3081675lbq; Thu, 17 Sep 2015 06:47:36 -0700 (PDT) X-Received: by 10.50.45.33 with SMTP id j1mr6191620igm.61.1442497656112; Thu, 17 Sep 2015 06:47:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gb2si2535355igd.62.2015.09.17.06.47.35; Thu, 17 Sep 2015 06:47:36 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752322AbbIQNrd (ORCPT + 30 others); Thu, 17 Sep 2015 09:47:33 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:36701 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751818AbbIQNqJ (ORCPT ); Thu, 17 Sep 2015 09:46:09 -0400 Received: by wicgb1 with SMTP id gb1so118742717wic.1 for ; Thu, 17 Sep 2015 06:46:08 -0700 (PDT) X-Received: by 10.180.182.107 with SMTP id ed11mr8009325wic.52.1442497568398; Thu, 17 Sep 2015 06:46:08 -0700 (PDT) Received: from x1.o2wifi.co.uk ([46.233.116.143]) by smtp.gmail.com with ESMTPSA id hk5sm3547895wjb.6.2015.09.17.06.46.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Sep 2015 06:46:07 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, peter@korsgaard.com, festevam@gmail.com, kieranbingham@gmail.com Cc: kernel@stlinux.com, Lee Jones Subject: [PATCH v2 3/7] hwrng: core: Simplify RNG switching from sysfs Date: Thu, 17 Sep 2015 14:45:53 +0100 Message-Id: <1442497557-9271-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442497557-9271-1-git-send-email-lee.jones@linaro.org> References: <1442497557-9271-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If we attempt to use sysfs to change the current RNG in the usual way i.e. issuing something like: `echo 8a8a000.rng > /sys/devices/virtual/misc/hw_random/rng_current` ... it will fail because the code doesn't currently take the '\n' into consideration. Well, now it does. Signed-off-by: Lee Jones Acked-by: Peter Korsgaard --- drivers/char/hw_random/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index da8faf7..2d4a969 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -323,7 +323,7 @@ static ssize_t hwrng_attr_current_store(struct device *dev, return -ERESTARTSYS; err = -ENODEV; list_for_each_entry(rng, &rng_list, list) { - if (strcmp(rng->name, buf) == 0) { + if (sysfs_streq(rng->name, buf)) { err = 0; if (rng != current_rng) err = set_current_rng(rng);