Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp1612218imb; Sun, 3 Mar 2019 00:06:48 -0800 (PST) X-Google-Smtp-Source: APXvYqzYs9GQbsHdy+vu+B7peja6nrSzWhot8Scksh4GHTANnw/bI5omHQdPttNQASktZtRJvI/n X-Received: by 2002:a17:902:20c3:: with SMTP id v3mr14590842plg.268.1551600408754; Sun, 03 Mar 2019 00:06:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551600408; cv=none; d=google.com; s=arc-20160816; b=CvXYv4OxO4DSBefD1aDGYdrYd0lQMUzl3o30LE1DQ+JFlVQGdfZjKCHylOCN8iqmZY 36vyr+is7FpPN3cwzDPYbJoRcfxm9hma5bWClFX1O3WSiHKzW5faZf33cDHp1sbCrfXb RTofro3VTEcmIztg1urVXLqN24vbyxS0F9UQcnwo9YuJPWLiJKcATzjuAaAaYUaqVu5u I5BMRlkLHWc6S8iVzMk0EQ7WdnmuIpRNoMMJ3JH8eOEJfA2py8uhTmpLXt3xhq7rAYRO lShbVsopWn6RbhXCFPKWeSHvivlTVNjeyfgmxph3yMYf2O41xAjjE/wVfRXY5/Srwgrg 8SqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LvZTmVT1jsV3BxPOh26T/e/XmRvmt+j3e9dCupSd5Vo=; b=pgkCeK87DaLE0xYBeha52AXkKHGxA0ZWdUuL4uc8/y8xAyWOobB6NkDZg/JT+HYCZN fNiJ0pEOJEOPDKI7gJQ8t+G79dPu2+b6W1h85JASCyT0ZUlsi5u9sxGgrw1bs/tpafqA pV1fgn402ObqfGIpu7xCPqmn89b1YtPRJQAYZ8XxVwojts0TNCfCCpwJgjDRAzMQ6GLd ffz/sNKodOXD/FhKsPmTjNkJhW+TnJ0yVnlI5+8dOIsvJPHfDxkAOmXmq6jNGdjn/xLL 7VP7BKmmIuIB/6i/robVB2r7YWZMSxhgBJx/QypHO3bnBbGNiwkEu7XG1hPrCTWaMD0E M8Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GSzbeUxw; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 22si2401087pgs.336.2019.03.03.00.06.19; Sun, 03 Mar 2019 00:06:48 -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=@kernel.org header.s=default header.b=GSzbeUxw; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725985AbfCCIFs (ORCPT + 99 others); Sun, 3 Mar 2019 03:05:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:43028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725923AbfCCIFr (ORCPT ); Sun, 3 Mar 2019 03:05:47 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4D4FB20863; Sun, 3 Mar 2019 08:05:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551600346; bh=i5zU1TP1AoRx2PU99jqYvVklsnNCDLsdkBjWgzCmUDo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GSzbeUxwu1ye9eYmjYQG3uR0dgYKiMCDO2FYuNZiEysvtTQKaerb3lYKb40D0iJiX u6dH4oeM/wgegzp2BcSTqUUtiFjW2dWuBlui0kKe+mhVOCPX/eNdcDGB+3nhbrJHMO 7ZJ8I2WU1F773n9FG4Ggbm1VA9pT/CJJ+mvnCQCU= Date: Sun, 3 Mar 2019 09:05:43 +0100 From: Greg KH To: Kimberly Brown Cc: Michael Kelley , Long Li , Sasha Levin , Stephen Hemminger , Dexuan Cui , "K. Y. Srinivasan" , Haiyang Zhang , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] Drivers: hv: vmbus: Expose monitor data only when monitor pages are used Message-ID: <20190303080543.GA32186@kroah.com> References: <20190226053530.GA2897@ubu-Virtual-Machine> <20190301191824.GA4108@ubu-Virtual-Machine> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190301191824.GA4108@ubu-Virtual-Machine> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 01, 2019 at 02:18:24PM -0500, Kimberly Brown wrote: > +/* > + * Channel-level attribute_group callback function. Returns the permission for > + * each attribute, and returns 0 if an attribute is not visible. > + */ > +static umode_t vmbus_chan_attr_is_visible(struct kobject *kobj, > + struct attribute *attr, int idx) > +{ > + const struct vmbus_channel *channel = > + container_of(kobj, struct vmbus_channel, kobj); > + > + /* Hide the monitor attributes if the monitor mechanism is not used. */ > + if (!channel->offermsg.monitor_allocated && > + (attr == &chan_attr_pending.attr || > + attr == &chan_attr_latency.attr || > + attr == &chan_attr_monitor_id.attr)) > + return 0; > + > + return attr->mode; > +} > + > +static struct attribute_group vmbus_chan_group = { > + .attrs = vmbus_chan_attrs, > + .is_visible = vmbus_chan_attr_is_visible > +}; > + > static struct kobj_type vmbus_chan_ktype = { > .sysfs_ops = &vmbus_chan_sysfs_ops, > .release = vmbus_chan_release, > - .default_attrs = vmbus_chan_attrs, Why did you remove this line? > }; > > /* > @@ -1571,6 +1624,12 @@ int vmbus_add_channel_kobj(struct hv_device *dev, struct vmbus_channel *channel) > if (ret) > return ret; > > + ret = sysfs_create_group(kobj, &vmbus_chan_group); Why are you adding these "by hand"? What was wrong with using the default attribute group pointer? You also are not removing the attributes :( greg k-h