cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

w1_internal.h (2694B)


      1/* SPDX-License-Identifier: GPL-2.0-or-later */
      2/*
      3 * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
      4 */
      5
      6#ifndef __W1_H
      7#define __W1_H
      8
      9#include <linux/w1.h>
     10
     11#include <linux/completion.h>
     12#include <linux/mutex.h>
     13
     14#define W1_SLAVE_ACTIVE		0
     15#define W1_SLAVE_DETACH		1
     16
     17/**
     18 * struct w1_async_cmd - execute callback from the w1_process kthread
     19 * @async_entry: link entry
     20 * @cb: callback function, must list_del and destroy this list before
     21 * returning
     22 *
     23 * When inserted into the w1_master async_list, w1_process will execute
     24 * the callback.  Embed this into the structure with the command details.
     25 */
     26struct w1_async_cmd {
     27	struct list_head	async_entry;
     28	void (*cb)(struct w1_master *dev, struct w1_async_cmd *async_cmd);
     29};
     30
     31int w1_create_master_attributes(struct w1_master *master);
     32void w1_destroy_master_attributes(struct w1_master *master);
     33void w1_search(struct w1_master *dev, u8 search_type,
     34	       w1_slave_found_callback cb);
     35void w1_search_devices(struct w1_master *dev, u8 search_type,
     36		       w1_slave_found_callback cb);
     37/* call w1_unref_slave to release the reference counts w1_search_slave added */
     38struct w1_slave *w1_search_slave(struct w1_reg_num *id);
     39/*
     40 * decrements the reference on sl->master and sl, and cleans up if zero
     41 * returns the reference count after it has been decremented
     42 */
     43int w1_unref_slave(struct w1_slave *sl);
     44void w1_slave_found(struct w1_master *dev, u64 rn);
     45void w1_search_process_cb(struct w1_master *dev, u8 search_type,
     46			  w1_slave_found_callback cb);
     47struct w1_slave *w1_slave_search_device(struct w1_master *dev,
     48					struct w1_reg_num *rn);
     49struct w1_master *w1_search_master_id(u32 id);
     50
     51/* Disconnect and reconnect devices in the given family.  Used for finding
     52 * unclaimed devices after a family has been registered or releasing devices
     53 * after a family has been unregistered.  Set attach to 1 when a new family
     54 * has just been registered, to 0 when it has been unregistered.
     55 */
     56void w1_reconnect_slaves(struct w1_family *f, int attach);
     57int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn);
     58/* 0 success, otherwise EBUSY */
     59int w1_slave_detach(struct w1_slave *sl);
     60
     61void __w1_remove_master_device(struct w1_master *dev);
     62
     63void w1_family_put(struct w1_family *f);
     64void __w1_family_get(struct w1_family *f);
     65struct w1_family *w1_family_registered(u8 fid);
     66
     67extern struct device_driver w1_master_driver;
     68extern struct device w1_master_device;
     69extern int w1_max_slave_count;
     70extern int w1_max_slave_ttl;
     71extern struct list_head w1_masters;
     72extern struct mutex w1_mlock;
     73extern spinlock_t w1_flock;
     74
     75int w1_process_callbacks(struct w1_master *dev);
     76int w1_process(void *data);
     77
     78#endif /* __W1_H */