netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Richard Cochran <richardcochran@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] ptp: use is_visible method to hide unused attributes
Date: Tue, 14 Feb 2017 10:07:47 -0800	[thread overview]
Message-ID: <20170214180747.GA4081@dtor-ws> (raw)
In-Reply-To: <20170214084226.GC8048@localhost.localdomain>

Hi Richard,

On Tue, Feb 14, 2017 at 09:42:26AM +0100, Richard Cochran wrote:
> On Mon, Feb 13, 2017 at 07:51:07PM -0800, Dmitry Torokhov wrote:
> > Instead of creating selected attributes after the device is created (and
> > after userspace potentially seen uevent), lets use attribute group
> > is_visible() method to control which attributes are shown. This will allow
> > us to create all attributes (except "pins" group, which will be taken care
> > of later) before userspace gets notified about new ptp class device.
> 
> At first glance, this patch and the next look like nice improvements.
> I don't futz around with sysfs code very often, and so may I ask how
> or whether you tested it?

I used the hack below.

Thanks.

-- 
Dmitry

PTP Test

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/net/ethernet/intel/e1000e/ptp.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/ptp.c b/drivers/net/ethernet/intel/e1000e/ptp.c
index 34cc3be0df8e..3b4c0d3e4093 100644
--- a/drivers/net/ethernet/intel/e1000e/ptp.c
+++ b/drivers/net/ethernet/intel/e1000e/ptp.c
@@ -260,18 +260,27 @@ static void e1000e_systim_overflow_work(struct work_struct *work)
 			      E1000_SYSTIM_OVERFLOW_PERIOD);
 }
 
+static struct ptp_pin_desc e1000e_ptp_pin_config[1] = {
+	{
+		.name = "TestPin1",
+		.index = 0,
+		.func = PTP_PF_NONE,
+	}
+};
+
 static const struct ptp_clock_info e1000e_ptp_clock_info = {
 	.owner		= THIS_MODULE,
 	.n_alarm	= 0,
 	.n_ext_ts	= 0,
-	.n_per_out	= 0,
-	.n_pins		= 0,
+	.n_per_out	= 1,
+	.n_pins		= 1,
 	.pps		= 0,
 	.adjfreq	= e1000e_phc_adjfreq,
 	.adjtime	= e1000e_phc_adjtime,
 	.gettime64	= e1000e_phc_gettime,
 	.settime64	= e1000e_phc_settime,
 	.enable		= e1000e_phc_enable,
+	.pin_config	= e1000e_ptp_pin_config,
 };
 
 /**

  reply	other threads:[~2017-02-14 18:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14  3:51 [PATCH 1/4] ptp: do not explicitly set drvdata in ptp_clock_register() Dmitry Torokhov
2017-02-14  3:51 ` [PATCH 2/4] ptp: use kcalloc/kmallco_array when allocating arrays Dmitry Torokhov
2017-02-14  8:38   ` Richard Cochran
2017-02-14  3:51 ` [PATCH 3/4] ptp: use is_visible method to hide unused attributes Dmitry Torokhov
2017-02-14  8:42   ` Richard Cochran
2017-02-14 18:07     ` Dmitry Torokhov [this message]
2017-02-14 18:13       ` Richard Cochran
2017-02-14  3:51 ` [PATCH 4/4] ptp: create "pins" together with the rest of attributes Dmitry Torokhov
2017-02-14  8:30 ` [PATCH 1/4] ptp: do not explicitly set drvdata in ptp_clock_register() Richard Cochran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170214180747.GA4081@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).