Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uapi: consolidate DIV_ROUND_UP definition #114

Closed
wants to merge 226 commits into from
Closed

uapi: consolidate DIV_ROUND_UP definition #114

wants to merge 226 commits into from

Conversation

BrianSidebotham
Copy link

Fixes #113

The inital goal was to consolidate ethtool.h uapi header. But I took the
opportunity to remove all duplicate definitions of DIV_ROUND_UP.

v3: add patch #2 and #3

v2: split the patch
define DIV_ROUND_UP in uapi

.../drm/vmwgfx/device_include/svga3d_surfacedefs.h | 20 +++++++++++---------
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 2 +-
include/linux/kernel.h | 2 +-
include/uapi/linux/ethtool.h | 7 ++++++-
include/uapi/linux/kernel.h | 1 +
include/uapi/linux/mroute6.h | 9 ++-------
6 files changed, 22 insertions(+), 19 deletions(-)

Regards,
Nicolas

Date: Fri, 4 Mar 2016 11:52:18 +0100
From: Nicolas Dichtel <[email protected]>
To: [email protected]
Cc: [email protected], [email protected],
Karen Xie <[email protected]>, [email protected],
[email protected], David Airlie <[email protected]>,
[email protected],
Nicolas Dichtel <[email protected]>
Subject: [PATCH net-next v3 3/4] drm/vmwgfx: remove userland definition of DIV_ROUND_UP

Let's use __KERNEL_DIV_ROUND_UP, which is defined in uapi/linux/kernel.h.

Signed-off-by: Nicolas Dichtel <[email protected]>

RobertCNelson and others added 30 commits January 31, 2017 17:10
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
… is defined

'owner' member of 'struct mutex' is defined as below
in 'include/linux/mutex.h':

struct mutex {
...
if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)
        struct task_struct      *owner;
endif
...

But function au_pin_hdir_set_owner() called owner as below:

 void au_pin_hdir_set_owner(struct au_pin *p, struct task_struct *task)
 {
if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)
        p->hdir->hi_inode->i_mutex.owner = task;
endif
 }

So if Kernel doesn't define 'DEBUG_MUTEXES' and 'MUTEX_SPIN_ON_OWNER',
but defines SMP, compiler will report the below error:

fs/aufs/i_op.c: In function 'au_pin_hdir_set_owner':
fs/aufs/i_op.c:593:28: error: 'struct mutex' has no member named 'owner'
  p->hdir->hi_inode->i_mutex.owner = task;
                            ^

Signed-off-by: Yanjiang Jin <[email protected]>
Signed-off-by: Bruce Ashfield <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Beyond the warning:

 drivers/tty/serial/8250/8250.c:1613:6: warning: unused variable ‘pass_counter’ [-Wunused-variable]

the solution of just looping infinitely was ugly - up it to 1 million to
give it a chance to continue in some really ugly situation.

Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
…eup() status

Enable/Clear module level UART wakeup in UART_OMAP_WER register based on
return value of device_may_wakeup() in .suspend(). This is allows
userspace to use sysfs to control the ability of UART to wakeup the
system from low power state. Register is restored back in .startup()
call that happens as part of resume sequence.

With this patch, userspace can control UART wakeup capability via sysfs:
To enable wakeup capability:
echo enabled >  /sys/class/tty/ttyXX/device/power/wakeup
For disabling wakeup capability:
echo disabled > /sys/class/tty/ttyXX/device/power/wakeup

Signed-off-by: Vignesh R <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
commit 6f724fb upstream.

In of_i2c_register_device(), when the check for
device address validity fails we print the info.addr,
which has not been assigned properly.

Fix this by printing the actual invalid address.

Signed-off-by: John Garry <[email protected]>
Reviewed-by: Vladimir Zapolskiy <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
Fixes: b4e2f6a ("i2c: apply DT flags when probing")
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
commit b321a38 upstream.

The oversampling ratio is controlled using the oversampling pins,
OS [2:0] with OS2 being the MSB control bit, and OS0 the LSB control
bit.

The gpio connected to the OS2 pin is not being set correctly, only OS0
and OS1 pins are being set. Fix the typo to allow proper control of the
oversampling pins.

Signed-off-by: Eva Rachel Retuya <[email protected]>
Fixes: b9618c0 ("staging: IIO: ADC: New driver for AD7606/AD7606-6/AD7606-4")
Acked-by: Lars-Peter Clausen <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Adds support for using a OMAP dual-mode timer with PWM capability
as a Linux PWM device. The driver controls the timer by using the
dmtimer API.

Add a platform_data structure for each pwm-omap-dmtimer nodes containing
the dmtimers functions in order to get driver not rely on platform
specific functions.

Cc: Grant Erickson <[email protected]>
Cc: NeilBrown <[email protected]>
Cc: Joachim Eastwood <[email protected]>
Suggested-by: Tony Lindgren <[email protected]>
Signed-off-by: Neil Armstrong <[email protected]>
Acked-by: Tony Lindgren <[email protected]>
[[email protected]: coding style bikeshed, fix timer leak]
Signed-off-by: Thierry Reding <[email protected]>
"omap" is NULL so we can't dereference it.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
In order to set the currently platform dependent dmtimer
functions pointers as platform data for the pwm-omap-dmtimer
platform driver, add it to plat-omap auxdata_lookup table.

Suggested-by: Tony Lindgren <[email protected]>
Signed-off-by: Neil Armstrong <[email protected]>
Signed-off-by: Tony Lindgren <[email protected]>
Fix the calculation of load_value and match_value. Currently they
are slightly too low, which produces a noticeably wrong PWM rate with
sufficiently short periods (i.e. when 1/period approaches clk_rate/2).

Example:
 clk_rate=32768Hz, period=122070ns, duty_cycle=61035ns (8192Hz/50% PWM)
 Correct values: load = 0xfffffffc, match = 0xfffffffd
 Current values: load = 0xfffffffa, match = 0xfffffffc
 effective PWM: period=183105ns, duty_cycle=91553ns (5461Hz/50% PWM)

Fixes: 6604c65 ("pwm: Add PWM driver for OMAP using dual-mode timers")
Signed-off-by: David Rivshin <[email protected]>
Acked-by: Neil Armstrong <[email protected]>
Tested-by: Adam Ford <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
Add sanity checking to ensure that we do not program load or match values
that are out of range if a user requests period or duty_cycle values which
are not achievable. The match value cannot be less than the load value (but
can be equal), and neither can be 0xffffffff. This means that there must be
at least one fclk cycle between load and match, and another between match
and overflow.

Fixes: 6604c65 ("pwm: Add PWM driver for OMAP using dual-mode timers")
Signed-off-by: David Rivshin <[email protected]>
Acked-by: Neil Armstrong <[email protected]>
[[email protected]: minor coding style cleanups]
Signed-off-by: Thierry Reding <[email protected]>
When converting period and duty_cycle from nanoseconds to fclk cycles,
the error introduced by the integer division can be appreciable, especially
in the case of slow fclk or short period. Use DIV_ROUND_CLOSEST_ULL() so
that the error is kept to +/- 0.5 clock cycles.

Fixes: 6604c65 ("pwm: Add PWM driver for OMAP using dual-mode timers")
Signed-off-by: David Rivshin <[email protected]>
Acked-by: Neil Armstrong <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
After going through the math and constraints checking to compute load
and match values, it is helpful to know what the resultant period and
duty cycle are.

Signed-off-by: David Rivshin <[email protected]>
Acked-by: Neil Armstrong <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
RobertCNelson and others added 24 commits January 31, 2017 17:12
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
I have encountered the same issue(s) on A6A boards.

I couldn't find a patch,  so I wrote this patch to update the device tree
in the davinci_mdio driver in the 3.15.1 tree, it seems to correct it. I
would welcome any input on a different approach.

https://groups.google.com/d/msg/beagleboard/9mctrG26Mc8/SRlnumt0LoMJ

v4.1-rcX: added hack around CONFIG_OF_OVERLAY
v4.2-rc3+: added if (of_machine_is_compatible("ti,am335x-bone")) so we do
not break dual ethernet am335x devices

Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Commit 520bd7a ("mmc: core: Optimize boot time by detecting cards
simultaneously") causes regressions for some platforms.

These platforms relies on fixed mmcblk device indexes, instead of
deploying the defacto standard with UUID/PARTUUID. In other words their
rootfs needs to be available at hardcoded paths, like /dev/mmcblk0p2.

Such guarantees have never been made by the kernel, but clearly the above
commit changes the behaviour. More precisely, because of that the order
changes of how cards becomes detected, so do their corresponding mmcblk
device indexes.

As the above commit significantly improves boot time for some platforms
(magnitude of seconds), let's avoid reverting this change but instead
restore the behaviour of how mmcblk device indexes becomes picked.

By using the same index for the mmcblk device as for the corresponding mmc
host device, the probe order of mmc host devices decides the index we get
for the mmcblk device.

For those platforms that suffers from a regression, one could expect that
this updated behaviour should be sufficient to meet their expectations of
"fixed" mmcblk device indexes.

Another side effect from this change, is that the same index is used for
the mmc host device, the mmcblk device and the mmc block queue. That
should clarify their relationship.

Reported-by: Peter Hurley <[email protected]>
Reported-by: Laszlo Fiat <[email protected]>
Cc: Linus Torvalds <[email protected]>
Fixes: 520bd7a ("mmc: core: Optimize boot time by detecting cards
simultaneously")
Cc: <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
The newly added dtc warning to check DT unit-address without reg
property and vice-versa generates lots of warnings. Turn off the check
unless building with W=1 or W=2.

Signed-off-by: Rob Herring <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: [email protected]
Recent versions of libfdt add a dependency on strnlen. Copy the
implementation in lib/string.c here, so we can update libfdt.

Acked-by: Russell King <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
The inital goal was to consolidate ethtool.h uapi header. But I took the
opportunity to remove all duplicate definitions of DIV_ROUND_UP.

v3: add patch #2 and #3

v2: split the patch
    define DIV_ROUND_UP in uapi

 .../drm/vmwgfx/device_include/svga3d_surfacedefs.h   | 20 +++++++++++---------
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c                   |  2 +-
 include/linux/kernel.h                               |  2 +-
 include/uapi/linux/ethtool.h                         |  7 ++++++-
 include/uapi/linux/kernel.h                          |  1 +
 include/uapi/linux/mroute6.h                         |  9 ++-------
 6 files changed, 22 insertions(+), 19 deletions(-)

Regards,
Nicolas

Date:	Fri,  4 Mar 2016 11:52:18 +0100
From:	Nicolas Dichtel <[email protected]>
To:	[email protected]
Cc:	[email protected], [email protected],
	Karen Xie <[email protected]>, [email protected],
	[email protected], David Airlie <[email protected]>,
	[email protected],
	Nicolas Dichtel <[email protected]>
Subject: [PATCH net-next v3 3/4] drm/vmwgfx: remove userland definition of DIV_ROUND_UP

Let's use __KERNEL_DIV_ROUND_UP, which is defined in uapi/linux/kernel.h.

Signed-off-by: Nicolas Dichtel <[email protected]>
@BrianSidebotham
Copy link
Author

Meh, this is now broke. Is this the correct place for pull requests, or is there some other repo I should pull request against?

RobertCNelson added a commit to RobertCNelson/ti-linux-kernel-dev that referenced this pull request Feb 10, 2017
RobertCNelson added a commit to RobertCNelson/ti-linux-kernel-dev that referenced this pull request Feb 10, 2017
RobertCNelson pushed a commit that referenced this pull request Feb 19, 2018
commit 5516e21 upstream.

Currently a crash can be seen if we reach the "err"
label in dmi_add_platform_ipmi(), calling
platform_device_put(), like here:
[    7.270584]  (null): ipmi:dmi: Unable to add resources: -16
[    7.330229] ------------[ cut here ]------------
[    7.334889] kernel BUG at mm/slub.c:3894!
[    7.338936] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[    7.344475] Modules linked in:
[    7.347556] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc2-00004-gbe9cb7b-dirty #114
[    7.355907] Hardware name: Huawei Taishan 2280 /D05, BIOS Hisilicon D05 IT17 Nemo 2.0 RC0 11/29/2017
[    7.365137] task: 00000000c211f6d3 task.stack: 00000000f276e9af
[    7.371116] pstate: 60000005 (nZCv daif -PAN -UAO)
[    7.375957] pc : kfree+0x194/0x1b4
[    7.379389] lr : platform_device_release+0xcc/0xd8
[    7.384225] sp : ffff0000092dba90
[    7.387567] x29: ffff0000092dba90 x28: ffff000008a83000
[    7.392933] x27: ffff0000092dbc10 x26: 00000000000000e6
[    7.398297] x25: 0000000000000003 x24: ffff0000085b51e8
[    7.403662] x23: 0000000000000100 x22: ffff7e0000234cc0
[    7.409027] x21: ffff000008af3660 x20: ffff8017d21acc10
[    7.414392] x19: ffff8017d21acc00 x18: 0000000000000002
[    7.419757] x17: 0000000000000001 x16: 0000000000000008
[    7.425121] x15: 0000000000000001 x14: 6666666678303d65
[    7.430486] x13: 6469727265766f5f x12: 7265766972642e76
[    7.435850] x11: 6564703e2d617020 x10: 6530326435373638
[    7.441215] x9 : 3030303030303030 x8 : 3d76656420657361
[    7.446580] x7 : ffff000008f59df8 x6 : ffff8017fbe0ea50
[    7.451945] x5 : 0000000000000000 x4 : 0000000000000000
[    7.457309] x3 : ffffffffffffffff x2 : 0000000000000000
[    7.462674] x1 : 0fffc00000000800 x0 : ffff7e0000234ce0
[    7.468039] Process swapper/0 (pid: 1, stack limit = 0x00000000f276e9af)
[    7.474809] Call trace:
[    7.477272]  kfree+0x194/0x1b4
[    7.480351]  platform_device_release+0xcc/0xd8
[    7.484837]  device_release+0x34/0x90
[    7.488531]  kobject_put+0x70/0xcc
[    7.491961]  put_device+0x14/0x1c
[    7.495304]  platform_device_put+0x14/0x1c
[    7.499439]  dmi_add_platform_ipmi+0x348/0x3ac
[    7.503923]  scan_for_dmi_ipmi+0xfc/0x10c
[    7.507970]  do_one_initcall+0x38/0x124
[    7.511840]  kernel_init_freeable+0x188/0x228
[    7.516238]  kernel_init+0x10/0x100
[    7.519756]  ret_from_fork+0x10/0x18
[    7.523362] Code: f94002c0 37780080 f94012c0 37000040 (d4210000)
[    7.529552] ---[ end trace 11750e4787deef9e ]---
[    7.534228] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    7.534228]

This is because when the device is released in
platform_device_release(), we try to free
pdev.driver_override. This is a const string, hence
the crash.
Fix by using dynamic memory for pdev->driver_override.

Signed-off-by: John Garry <[email protected]>
[Removed the free of driver_override from ipmi_si_remove_by_dev().  The
 free is done in platform_device_release(), and would result in a double
 free, and ipmi_si_remove_by_dev() is called by non-platform devices.]
Signed-off-by: Corey Minyard <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.