Skip to content

Commit

Permalink
Merge branch 'akpm' (patches from Andrew)
Browse files Browse the repository at this point in the history
Merge more updates from Andrew Morton:

 - most of the rest of MM

 - a small number of misc things

 - lib/ updates

 - checkpatch

 - autofs updates

 - ipc/ updates

* emailed patches from Andrew Morton <[email protected]>: (126 commits)
  ipc: optimize semget/shmget/msgget for lots of keys
  ipc/sem: play nicer with large nsops allocations
  ipc/sem: drop sem_checkid helper
  ipc: convert kern_ipc_perm.refcount from atomic_t to refcount_t
  ipc: convert sem_undo_list.refcnt from atomic_t to refcount_t
  ipc: convert ipc_namespace.count from atomic_t to refcount_t
  kcov: support compat processes
  sh: defconfig: cleanup from old Kconfig options
  mn10300: defconfig: cleanup from old Kconfig options
  m32r: defconfig: cleanup from old Kconfig options
  drivers/pps: use surrounding "if PPS" to remove numerous dependency checks
  drivers/pps: aesthetic tweaks to PPS-related content
  cpumask: make cpumask_next() out-of-line
  kmod: move #ifdef CONFIG_MODULES wrapper to Makefile
  kmod: split off umh headers into its own file
  MAINTAINERS: clarify kmod is just a kernel module loader
  kmod: split out umh code into its own file
  test_kmod: flip INT checks to be consistent
  test_kmod: remove paranoid UINT_MAX check on uint range processing
  vfat: deduplicate hex2bin()
  ...
  • Loading branch information
torvalds committed Sep 9, 2017
2 parents c054be1 + 0cfb6ae commit fbf4432
Show file tree
Hide file tree
Showing 271 changed files with 7,222 additions and 2,011 deletions.
8 changes: 6 additions & 2 deletions Documentation/devicetree/bindings/pps/pps-gpio.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ Optional properties:

Example:
pps {
compatible = "pps-gpio";
gpios = <&gpio2 6 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pps>;

gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
assert-falling-edge;

compatible = "pps-gpio";
status = "okay";
};
44 changes: 23 additions & 21 deletions Documentation/pps/pps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ problem:
time_pps_create().

This implies that the source has a /dev/... entry. This assumption is
ok for the serial and parallel port, where you can do something
OK for the serial and parallel port, where you can do something
useful besides(!) the gathering of timestamps as it is the central
task for a PPS-API. But this assumption does not work for a single
task for a PPS API. But this assumption does not work for a single
purpose GPIO line. In this case even basic file-related functionality
(like read() and write()) makes no sense at all and should not be a
precondition for the use of a PPS-API.
precondition for the use of a PPS API.

The problem can be simply solved if you consider that a PPS source is
not always connected with a GPS data source.
Expand Down Expand Up @@ -88,13 +88,13 @@ Coding example
--------------

To register a PPS source into the kernel you should define a struct
pps_source_info_s as follows:
pps_source_info as follows:

static struct pps_source_info pps_ktimer_info = {
.name = "ktimer",
.path = "",
.mode = PPS_CAPTUREASSERT | PPS_OFFSETASSERT | \
PPS_ECHOASSERT | \
.mode = PPS_CAPTUREASSERT | PPS_OFFSETASSERT |
PPS_ECHOASSERT |
PPS_CANWAIT | PPS_TSFMT_TSPEC,
.echo = pps_ktimer_echo,
.owner = THIS_MODULE,
Expand All @@ -108,13 +108,13 @@ initialization routine as follows:

The pps_register_source() prototype is:

int pps_register_source(struct pps_source_info_s *info, int default_params)
int pps_register_source(struct pps_source_info *info, int default_params)

where "info" is a pointer to a structure that describes a particular
PPS source, "default_params" tells the system what the initial default
parameters for the device should be (it is obvious that these parameters
must be a subset of ones defined in the struct
pps_source_info_s which describe the capabilities of the driver).
pps_source_info which describe the capabilities of the driver).

Once you have registered a new PPS source into the system you can
signal an assert event (for example in the interrupt handler routine)
Expand Down Expand Up @@ -142,8 +142,10 @@ If the SYSFS filesystem is enabled in the kernel it provides a new class:
Every directory is the ID of a PPS sources defined in the system and
inside you find several files:

$ ls /sys/class/pps/pps0/
assert clear echo mode name path subsystem@ uevent
$ ls -F /sys/class/pps/pps0/
assert dev mode path subsystem@
clear echo name power/ uevent


Inside each "assert" and "clear" file you can find the timestamp and a
sequence number:
Expand All @@ -154,40 +156,40 @@ sequence number:
Where before the "#" is the timestamp in seconds; after it is the
sequence number. Other files are:

* echo: reports if the PPS source has an echo function or not;
* echo: reports if the PPS source has an echo function or not;

* mode: reports available PPS functioning modes;
* mode: reports available PPS functioning modes;

* name: reports the PPS source's name;
* name: reports the PPS source's name;

* path: reports the PPS source's device path, that is the device the
PPS source is connected to (if it exists).
* path: reports the PPS source's device path, that is the device the
PPS source is connected to (if it exists).


Testing the PPS support
-----------------------

In order to test the PPS support even without specific hardware you can use
the ktimer driver (see the client subsection in the PPS configuration menu)
the pps-ktimer driver (see the client subsection in the PPS configuration menu)
and the userland tools available in your distribution's pps-tools package,
http://linuxpps.org , or https://github.com/ago/pps-tools .
http://linuxpps.org , or https://github.com/redlab-i/pps-tools.

Once you have enabled the compilation of ktimer just modprobe it (if
Once you have enabled the compilation of pps-ktimer just modprobe it (if
not statically compiled):

# modprobe ktimer
# modprobe pps-ktimer

and the run ppstest as follow:

$ ./ppstest /dev/pps0
$ ./ppstest /dev/pps1
trying PPS source "/dev/pps1"
found PPS source "/dev/pps1"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1186592699.388832443, sequence: 364 - clear 0.000000000, sequence: 0
source 0 - assert 1186592700.388931295, sequence: 365 - clear 0.000000000, sequence: 0
source 0 - assert 1186592701.389032765, sequence: 366 - clear 0.000000000, sequence: 0

Please, note that to compile userland programs you need the file timepps.h .
Please note that to compile userland programs, you need the file timepps.h.
This is available in the pps-tools repository mentioned above.


Expand Down
33 changes: 33 additions & 0 deletions Documentation/rbtree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,39 @@ Example::
for (node = rb_first(&mytree); node; node = rb_next(node))
printk("key=%s\n", rb_entry(node, struct mytype, node)->keystring);

Cached rbtrees
--------------

Computing the leftmost (smallest) node is quite a common task for binary
search trees, such as for traversals or users relying on a the particular
order for their own logic. To this end, users can use 'struct rb_root_cached'
to optimize O(logN) rb_first() calls to a simple pointer fetch avoiding
potentially expensive tree iterations. This is done at negligible runtime
overhead for maintanence; albeit larger memory footprint.

Similar to the rb_root structure, cached rbtrees are initialized to be
empty via:

struct rb_root_cached mytree = RB_ROOT_CACHED;

Cached rbtree is simply a regular rb_root with an extra pointer to cache the
leftmost node. This allows rb_root_cached to exist wherever rb_root does,
which permits augmented trees to be supported as well as only a few extra
interfaces:

struct rb_node *rb_first_cached(struct rb_root_cached *tree);
void rb_insert_color_cached(struct rb_node *, struct rb_root_cached *, bool);
void rb_erase_cached(struct rb_node *node, struct rb_root_cached *);

Both insert and erase calls have their respective counterpart of augmented
trees:

void rb_insert_augmented_cached(struct rb_node *node, struct rb_root_cached *,
bool, struct rb_augment_callbacks *);
void rb_erase_augmented_cached(struct rb_node *, struct rb_root_cached *,
struct rb_augment_callbacks *);


Support for Augmented rbtrees
-----------------------------

Expand Down
Loading

0 comments on commit fbf4432

Please sign in to comment.