From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751598AbdBNSXq (ORCPT ); Tue, 14 Feb 2017 13:23:46 -0500 Received: from mail-oi0-f67.google.com ([209.85.218.67]:34622 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751404AbdBNSXh (ORCPT ); Tue, 14 Feb 2017 13:23:37 -0500 From: Dmitry Torokhov To: Richard Cochran Cc: "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/4] PTP attribute handling cleanup Date: Tue, 14 Feb 2017 10:23:30 -0800 Message-Id: <20170214182334.23296-1-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.11.0.483.g087da7b7c-goog Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PTP core was creating some attributes, such as "period" and "fifo", and the entire "pins" attribute group, after creating class deevice, which creates a race for userspace: uevent may arrive before all attributes are created. This series of patches switches PTP to use is_visible() to control visibility of attributes in a group, and device_create_with_groups() to ensure that attributes are created before we notify userspace of a new device. v2: - added Richard's acked-by to patch #1 - removed use of kmalloc_array in favor of kcalloc in patch #2 at Richard's request - added a cover letter v1: - initial patch set Dmitry Torokhov (4): ptp: do not explicitly set drvdata in ptp_clock_register() ptp: use kcalloc when allocating arrays ptp: use is_visible method to hide unused attributes ptp: create "pins" together with the rest of attributes drivers/ptp/ptp_clock.c | 22 +++--- drivers/ptp/ptp_private.h | 7 +- drivers/ptp/ptp_sysfs.c | 167 ++++++++++++++++++---------------------------- 3 files changed, 80 insertions(+), 116 deletions(-) Thanks. -- Dmitry