Ignore:
Timestamp:
Sep 18, 2022, 7:39:50 AM (3 years ago)
Author:
Paul Smedley
Message:

Initial commit of 5.17.15

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-exp/lib32/misc.c

    r639 r737  
    2828#include <linux/init.h>
    2929#include <linux/fs.h>
     30#include <linux/of.h>
    3031#include <linux/poll.h>
    3132#define CONFIG_PROC_FS 1
     
    784785        free_pages((unsigned long) ptr, pg);
    785786}
     787
     788/**
     789 * of_node_put() - Decrement refcount of a node
     790 * @node:       Node to dec refcount, NULL is supported to simplify writing of
     791 *              callers
     792 */
     793void of_node_put(struct device_node *node)
     794{
     795        if (node)
     796                kobject_put(&node->kobj);
     797}
     798
     799/**
     800 * sysfs_streq - return true if strings are equal, modulo trailing newline
     801 * @s1: one string
     802 * @s2: another string
     803 *
     804 * This routine returns true iff two strings are equal, treating both
     805 * NUL and newline-then-NUL as equivalent string terminations.  It's
     806 * geared for use with sysfs input strings, which generally terminate
     807 * with newlines but are compared against values without newlines.
     808 */
     809bool sysfs_streq(const char *s1, const char *s2)
     810{
     811        while (*s1 && *s1 == *s2) {
     812                s1++;
     813                s2++;
     814        }
     815
     816        if (*s1 == *s2)
     817                return true;
     818        if (!*s1 && *s2 == '\n' && !s2[1])
     819                return true;
     820        if (*s1 == '\n' && !s1[1] && !*s2)
     821                return true;
     822        return false;
     823}
     824EXPORT_SYMBOL(sysfs_streq);
Note: See TracChangeset for help on using the changeset viewer.