From patchwork Fri Jun 5 19:24:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 6557671 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 265EA9F3D1 for ; Fri, 5 Jun 2015 19:24:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4AC4D204EC for ; Fri, 5 Jun 2015 19:24:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 395EC2043C for ; Fri, 5 Jun 2015 19:24:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF1606E04C; Fri, 5 Jun 2015 12:24:11 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pandora.arm.linux.org.uk (pandora.arm.linux.org.uk [78.32.30.218]) by gabe.freedesktop.org (Postfix) with ESMTP id 6540A6E04C for ; Fri, 5 Jun 2015 12:24:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=Wclsw2QD8QXc1IlL2usTxt5v7hlLYsPY+R4xvXZiXWk=; b=dRcnxGkYMV1MiRRmWFnKzbZixegQioeKsWjK96CNTYOkLWS3GL/pmLL+0gKnf6kzUDCONDEENSCuXx1FxbNeki9y/3lA/zcphovAhzQ9A35S7x9EuKWSjS+PJPe2v9CIbKzp8hJ20VOzQcAUxtliaUmYKxTagL6efWO5JqD3BWs=; Received: from n2100.arm.linux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:52630) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1Z0xDq-0001HS-Oj; Fri, 05 Jun 2015 20:24:06 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1Z0xDk-0000jl-HX; Fri, 05 Jun 2015 20:24:00 +0100 Date: Fri, 5 Jun 2015 20:24:00 +0100 From: Russell King - ARM Linux To: Chris Wilson Subject: Re: [PATCH] drm: fix writing to /sys/class/drm/*/status Message-ID: <20150605192400.GP7557@n2100.arm.linux.org.uk> References: <20150605185638.GX27056@nuc-i3427.alporthouse.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150605185638.GX27056@nuc-i3427.alporthouse.com> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jun 05, 2015 at 07:56:38PM +0100, Chris Wilson wrote: > On Fri, Jun 05, 2015 at 07:47:22PM +0100, Russell King wrote: > > Writing to a file is supposed to return the number of bytes written. > > Returning zero unfortunately causes bash to constantly spin trying > > to write to the sysfs file, to such an extent that even ^c and ^z > > have no effect. The only way out of that is to kill the shell and > > log back in. This isn't nice behaviour. > > > > Fix it by returning the number of characters written to sysfs files. > > > > Signed-off-by: Russell King > > Oops. > > Fixes: c484f02d0f02fbbfc6decc945a69aae011041a27 > Reviewed-by: Chris Wilson > > Dave, we need this for 4.1... Viro suggests an alternative, simpler fix: Would you prefer this one? diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index ffc305fc2076..eb7e61078a5b 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -217,7 +217,7 @@ static ssize_t status_store(struct device *device, mutex_unlock(&dev->mode_config.mutex); - return ret; + return ret ? ret : count; } static ssize_t status_show(struct device *device,