···1111#include "ozeltbuf.h"1212#include "ozpd.h"13131414-/*------------------------------------------------------------------------------1515- */1614#define OZ_ELT_INFO_MAGIC_USED 0x357910571715#define OZ_ELT_INFO_MAGIC_FREE 0x789401021818-/*------------------------------------------------------------------------------1616+1717+/*1918 * Context: softirq-serialized2019 */2120int oz_elt_buf_init(struct oz_elt_buf *buf)···2829 return 0;2930}30313131-/*------------------------------------------------------------------------------3232+/*3233 * Context: softirq or process3334 */3435void oz_elt_buf_term(struct oz_elt_buf *buf)···6162 buf->free_elts = 0;6263}63646464-/*------------------------------------------------------------------------------6565+/*6566 * Context: softirq or process6667 */6768struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf)···9596 return ei;9697}97989898-/*------------------------------------------------------------------------------9999+/*99100 * Precondition: oz_elt_buf.lock must be held.100101 * Context: softirq or process101102 */···132133 spin_unlock_bh(&buf->lock);133134}134135135135-/*------------------------------------------------------------------------------136136- */137136int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count)138137{139138 struct oz_elt_stream *st;···151154 return 0;152155}153156154154-/*------------------------------------------------------------------------------155155- */156157int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)157158{158159 struct list_head *e;···189194 return 0;190195}191196192192-/*------------------------------------------------------------------------------193193- */194197void oz_elt_stream_get(struct oz_elt_stream *st)195198{196199 atomic_inc(&st->ref_count);197200}198201199199-/*------------------------------------------------------------------------------200200- */201202void oz_elt_stream_put(struct oz_elt_stream *st)202203{203204 if (atomic_dec_and_test(&st->ref_count)) {···202211 }203212}204213205205-/*------------------------------------------------------------------------------214214+/*206215 * Precondition: Element buffer lock must be held.207216 * If this function fails the caller is responsible for deallocating the elt208217 * info structure.···266275 return 0;267276}268277269269-/*------------------------------------------------------------------------------270270- */271278int oz_select_elts_for_tx(struct oz_elt_buf *buf, u8 isoc, unsigned *len,272279 unsigned max_len, struct list_head *list)273280{···311322 return count;312323}313324314314-/*------------------------------------------------------------------------------315315- */316325int oz_are_elts_available(struct oz_elt_buf *buf)317326{318327 return buf->order_list.next != &buf->order_list;319328}320329321321-/*------------------------------------------------------------------------------322322- */323330void oz_trim_elt_pool(struct oz_elt_buf *buf)324331{325332 struct list_head *free = NULL;
+66-68
drivers/staging/ozwpan/ozhcd.c
···3535#include "ozurbparanoia.h"3636#include "ozhcd.h"37373838-/*------------------------------------------------------------------------------3838+/*3939 * Number of units of buffering to capture for an isochronous IN endpoint before4040 * allowing data to be indicated up.4141 */···5757 */5858#define EP0_TIMEOUT_COUNTER 1359596060-/*------------------------------------------------------------------------------6060+/*6161 * Used to link urbs together and also store some status information for each6262 * urb.6363 * A cache of these are kept in a pool to reduce number of calls to kmalloc.···144144 */145145#define OZ_HDC_F_SUSPENDED 0x1146146147147-/*------------------------------------------------------------------------------147147+/*148148 * Static function prototypes.149149 */150150static int oz_hcd_start(struct usb_hcd *hcd);···185185 struct urb *urb);186186static void oz_hcd_clear_orphanage(struct oz_hcd *ozhcd, int status);187187188188-/*------------------------------------------------------------------------------188188+/*189189 * Static external variables.190190 */191191static struct platform_device *g_plat_dev;···231231 },232232};233233234234-/*------------------------------------------------------------------------------234234+/*235235 * Gets our private context area (which is of type struct oz_hcd) from the236236 * usb_hcd structure.237237 * Context: any···241241 return (struct oz_hcd *)hcd->hcd_priv;242242}243243244244-/*------------------------------------------------------------------------------244244+/*245245 * Searches list of ports to find the index of the one with a specified USB246246 * bus address. If none of the ports has the bus address then the connection247247 * port is returned, if there is one or -1 otherwise.···258258 return ozhcd->conn_port;259259}260260261261-/*------------------------------------------------------------------------------261261+/*262262 * Allocates an urb link, first trying the pool but going to heap if empty.263263 * Context: any264264 */···279279 return urbl;280280}281281282282-/*------------------------------------------------------------------------------282282+/*283283 * Frees an urb link by putting it in the pool if there is enough space or284284 * deallocating it to heap otherwise.285285 * Context: any···300300 }301301}302302303303-/*------------------------------------------------------------------------------303303+/*304304 * Deallocates all the urb links in the pool.305305 * Context: unknown306306 */···322322 }323323}324324325325-/*------------------------------------------------------------------------------325325+/*326326 * Allocates endpoint structure and optionally a buffer. If a buffer is327327 * allocated it immediately follows the endpoint structure.328328 * Context: softirq···343343 return ep;344344}345345346346-/*------------------------------------------------------------------------------346346+/*347347 * Pre-condition: Must be called with g_tasklet_lock held and interrupts348348 * disabled.349349 * Context: softirq or process···363363 return NULL;364364}365365366366-/*------------------------------------------------------------------------------366366+/*367367 * This is called when we have finished processing an urb. It unlinks it from368368 * the ep and returns it to the core.369369 * Context: softirq or process···407407 oz_free_urb_link(cancel_urbl);408408}409409410410-/*------------------------------------------------------------------------------410410+/*411411 * Deallocates an endpoint including deallocating any associated stream and412412 * returning any queued urbs to the core.413413 * Context: softirq···432432 kfree(ep);433433}434434435435-/*------------------------------------------------------------------------------435435+/*436436 * Context: softirq437437 */438438static void oz_complete_buffered_urb(struct oz_port *port,···471471 oz_complete_urb(port->ozhcd->hcd, urb, 0);472472}473473474474-/*------------------------------------------------------------------------------474474+/*475475 * Context: softirq476476 */477477static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,···543543 return err;544544}545545546546-/*------------------------------------------------------------------------------546546+/*547547 * Removes an urb from the queue in the endpoint.548548 * Returns 0 if it is found and -EIDRM otherwise.549549 * Context: softirq···576576 return urbl ? 0 : -EIDRM;577577}578578579579-/*------------------------------------------------------------------------------579579+/*580580 * Finds an urb given its request id.581581 * Context: softirq582582 */···609609 return urb;610610}611611612612-/*------------------------------------------------------------------------------612612+/*613613 * Pre-condition: Port lock must be held.614614 * Context: softirq615615 */···624624 port->hpd = hpd;625625}626626627627-/*------------------------------------------------------------------------------627627+/*628628 * Context: softirq629629 */630630static struct oz_hcd *oz_hcd_claim(void)···639639 return ozhcd;640640}641641642642-/*------------------------------------------------------------------------------642642+/*643643 * Context: softirq644644 */645645static inline void oz_hcd_put(struct oz_hcd *ozhcd)···648648 usb_put_hcd(ozhcd->hcd);649649}650650651651-/*------------------------------------------------------------------------------651651+/*652652 * This is called by the protocol handler to notify that a PD has arrived.653653 * We allocate a port to associate with the PD and create a structure for654654 * endpoint 0. This port is made the connection port.···714714 return NULL;715715}716716717717-/*------------------------------------------------------------------------------717717+/*718718 * This is called by the protocol handler to notify that the PD has gone away.719719 * We need to deallocate all resources and then request that the root hub is720720 * polled. We release the reference we hold on the PD.···770770 oz_usb_put(hpd);771771}772772773773-/*------------------------------------------------------------------------------773773+/*774774 * Context: softirq775775 */776776void oz_hcd_pd_reset(void *hpd, void *hport)···790790 usb_hcd_poll_rh_status(ozhcd->hcd);791791}792792793793-/*------------------------------------------------------------------------------793793+/*794794 * Context: softirq795795 */796796void oz_hcd_get_desc_cnf(void *hport, u8 req_id, int status, const u8 *desc,···836836 oz_complete_urb(port->ozhcd->hcd, urb, 0);837837}838838839839-/*------------------------------------------------------------------------------839839+/*840840 * Context: softirq841841 */842842static void oz_display_conf_type(u8 t)···878878 }879879}880880881881-/*------------------------------------------------------------------------------881881+/*882882 * Context: softirq883883 */884884static void oz_hcd_complete_set_config(struct oz_port *port, struct urb *urb,···900900 oz_complete_urb(hcd, urb, rc);901901}902902903903-/*------------------------------------------------------------------------------903903+/*904904 * Context: softirq905905 */906906static void oz_hcd_complete_set_interface(struct oz_port *port, struct urb *urb,···927927 oz_complete_urb(hcd, urb, rc);928928}929929930930-/*------------------------------------------------------------------------------930930+/*931931 * Context: softirq932932 */933933void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, const u8 *data,···980980 }981981}982982983983-/*------------------------------------------------------------------------------983983+/*984984 * Context: softirq-serialized985985 */986986static int oz_hcd_buffer_data(struct oz_endpoint *ep, const u8 *data,···10181018 return 0;10191019}1020102010211021-/*------------------------------------------------------------------------------10211021+/*10221022 * Context: softirq-serialized10231023 */10241024void oz_hcd_data_ind(void *hport, u8 endpoint, const u8 *data, int data_len)···10651065 spin_unlock_bh(&ozhcd->hcd_lock);10661066}1067106710681068-/*------------------------------------------------------------------------------10681068+/*10691069 * Context: unknown10701070 */10711071static inline int oz_usb_get_frame_number(void)···10731073 return atomic_inc_return(&g_usb_frame_number);10741074}1075107510761076-/*------------------------------------------------------------------------------10761076+/*10771077 * Context: softirq10781078 */10791079int oz_hcd_heartbeat(void *hport)···12341234 return rc;12351235}1236123612371237-/*------------------------------------------------------------------------------12371237+/*12381238 * Context: softirq12391239 */12401240static int oz_build_endpoints_for_interface(struct usb_hcd *hcd,···13151315 return 0;13161316}1317131713181318-/*------------------------------------------------------------------------------13181318+/*13191319 * Context: softirq13201320 */13211321static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd,···13611361 }13621362}1363136313641364-/*------------------------------------------------------------------------------13641364+/*13651365 * Context: softirq13661366 */13671367static int oz_build_endpoints_for_config(struct usb_hcd *hcd,···13971397 return -1;13981398}1399139914001400-/*------------------------------------------------------------------------------14001400+/*14011401 * Context: softirq14021402 */14031403static void oz_clean_endpoints_for_config(struct usb_hcd *hcd,···14191419 spin_unlock_bh(&ozhcd->hcd_lock);14201420}1421142114221422-/*------------------------------------------------------------------------------14221422+/*14231423 * Context: tasklet14241424 */14251425static void *oz_claim_hpd(struct oz_port *port)···14351435 return hpd;14361436}1437143714381438-/*------------------------------------------------------------------------------14381438+/*14391439 * Context: tasklet14401440 */14411441static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb,···15821582 }15831583}1584158415851585-/*------------------------------------------------------------------------------15851585+/*15861586 * Context: tasklet15871587 */15881588static int oz_urb_process(struct oz_hcd *ozhcd, struct urb *urb)···16171617 return rc;16181618}1619161916201620-/*------------------------------------------------------------------------------16201620+/*16211621 * Context: tasklet16221622 */16231623static void oz_urb_process_tasklet(unsigned long unused)···16511651 oz_hcd_put(ozhcd);16521652}1653165316541654-/*------------------------------------------------------------------------------16541654+/*16551655 * This function searches for the urb in any of the lists it could be in.16561656 * If it is found it is removed from the list and completed. If the urb is16571657 * being processed then it won't be in a list so won't be found. However, the···17191719 }17201720}1721172117221722-/*------------------------------------------------------------------------------17221722+/*17231723 * Context: tasklet17241724 */17251725static void oz_urb_cancel_tasklet(unsigned long unused)···17471747 oz_hcd_put(ozhcd);17481748}1749174917501750-/*------------------------------------------------------------------------------17501750+/*17511751 * Context: unknown17521752 */17531753static void oz_hcd_clear_orphanage(struct oz_hcd *ozhcd, int status)···17641764 }17651765}1766176617671767-/*------------------------------------------------------------------------------17671767+/*17681768 * Context: unknown17691769 */17701770static int oz_hcd_start(struct usb_hcd *hcd)···17751775 return 0;17761776}1777177717781778-/*------------------------------------------------------------------------------17781778+/*17791779 * Context: unknown17801780 */17811781static void oz_hcd_stop(struct usb_hcd *hcd)17821782{17831783}1784178417851785-/*------------------------------------------------------------------------------17851785+/*17861786 * Context: unknown17871787 */17881788static void oz_hcd_shutdown(struct usb_hcd *hcd)17891789{17901790}1791179117921792-/*------------------------------------------------------------------------------17921792+/*17931793 * Called to queue an urb for the device.17941794 * This function should return a non-zero error code if it fails the urb but17951795 * should not call usb_hcd_giveback_urb().···18471847 return 0;18481848}1849184918501850-/*------------------------------------------------------------------------------18501850+/*18511851 * Context: tasklet18521852 */18531853static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep,···18731873 return NULL;18741874}1875187518761876-/*------------------------------------------------------------------------------18761876+/*18771877 * Called to dequeue a previously submitted urb for the device.18781878 * Context: any18791879 */···19151915 return rc;19161916}1917191719181918-/*------------------------------------------------------------------------------19181918+/*19191919 * Context: unknown19201920 */19211921static void oz_hcd_endpoint_disable(struct usb_hcd *hcd,···19231923{19241924}1925192519261926-/*------------------------------------------------------------------------------19261926+/*19271927 * Context: unknown19281928 */19291929static void oz_hcd_endpoint_reset(struct usb_hcd *hcd,···19311931{19321932}1933193319341934-/*------------------------------------------------------------------------------19341934+/*19351935 * Context: unknown19361936 */19371937static int oz_hcd_get_frame_number(struct usb_hcd *hcd)···19401940 return oz_usb_get_frame_number();19411941}1942194219431943-/*------------------------------------------------------------------------------19431943+/*19441944 * Context: softirq19451945 * This is called as a consquence of us calling usb_hcd_poll_rh_status() and we19461946 * always do that in softirq context.···19711971 return 0;19721972}1973197319741974-/*------------------------------------------------------------------------------19741974+/*19751975 * Context: process19761976 */19771977static void oz_get_hub_descriptor(struct usb_hcd *hcd,···19851985 desc->bNbrPorts = OZ_NB_PORTS;19861986}1987198719881988-/*------------------------------------------------------------------------------19881988+/*19891989 * Context: process19901990 */19911991static int oz_set_port_feature(struct usb_hcd *hcd, u16 wvalue, u16 windex)···20612061 return err;20622062}2063206320642064-/*------------------------------------------------------------------------------20642064+/*20652065 * Context: process20662066 */20672067static int oz_clear_port_feature(struct usb_hcd *hcd, u16 wvalue, u16 windex)···21372137 return err;21382138}2139213921402140-/*------------------------------------------------------------------------------21402140+/*21412141 * Context: process21422142 */21432143static int oz_get_port_status(struct usb_hcd *hcd, u16 windex, char *buf)···21552155 return 0;21562156}2157215721582158-/*------------------------------------------------------------------------------21582158+/*21592159 * Context: process21602160 */21612161static int oz_hcd_hub_control(struct usb_hcd *hcd, u16 req_type, u16 wvalue,···21932193 return err;21942194}2195219521962196-/*------------------------------------------------------------------------------21962196+/*21972197 * Context: process21982198 */21992199static int oz_hcd_bus_suspend(struct usb_hcd *hcd)···22082208 return 0;22092209}2210221022112211-/*------------------------------------------------------------------------------22112211+/*22122212 * Context: process22132213 */22142214static int oz_hcd_bus_resume(struct usb_hcd *hcd)···22232223 return 0;22242224}2225222522262226-/*------------------------------------------------------------------------------22272227- */22282226static void oz_plat_shutdown(struct platform_device *dev)22292227{22302228}2231222922322232-/*------------------------------------------------------------------------------22302230+/*22332231 * Context: process22342232 */22352233static int oz_plat_probe(struct platform_device *dev)···22702272 return 0;22712273}2272227422732273-/*------------------------------------------------------------------------------22752275+/*22742276 * Context: unknown22752277 */22762278static int oz_plat_remove(struct platform_device *dev)···22942296 return 0;22952297}2296229822972297-/*------------------------------------------------------------------------------22992299+/*22982300 * Context: unknown22992301 */23002302static int oz_plat_suspend(struct platform_device *dev, pm_message_t msg)···23032305}230423062305230723062306-/*------------------------------------------------------------------------------23082308+/*23072309 * Context: unknown23082310 */23092311static int oz_plat_resume(struct platform_device *dev)···23112313 return 0;23122314}2313231523142314-/*------------------------------------------------------------------------------23162316+/*23152317 * Context: process23162318 */23172319int oz_hcd_init(void)···23482350 return err;23492351}2350235223512351-/*------------------------------------------------------------------------------23532353+/*23522354 * Context: process23532355 */23542356void oz_hcd_term(void)
+3-5
drivers/staging/ozwpan/ozmain.c
···18181919unsigned int oz_dbg_mask = OZ_DEFAULT_DBG_MASK;20202121-/*------------------------------------------------------------------------------2121+/*2222 * The name of the 802.11 mac device. Empty string is the default value but a2323 * value can be supplied as a parameter to the module. An empty string means2424 * bind to nothing. '*' means bind to all netcards - this includes non-802.11···2626 */2727static char *g_net_dev = "";28282929-/*------------------------------------------------------------------------------2929+/*3030 * Context: process3131 */3232static int __init ozwpan_init(void)···3838 return 0;3939}40404141-/*------------------------------------------------------------------------------4141+/*4242 * Context: process4343 */4444static void __exit ozwpan_exit(void)···4848 oz_cdev_deregister();4949}50505151-/*------------------------------------------------------------------------------5252- */5351module_param(g_net_dev, charp, S_IRUGO);5452module_init(ozwpan_init);5553module_exit(ozwpan_exit);
···2828#include "ozhcd.h"2929#include "ozusbsvc.h"30303131-/*------------------------------------------------------------------------------3131+/*3232 * This is called once when the driver is loaded to initialise the USB service.3333 * Context: process3434 */···3737 return oz_hcd_init();3838}39394040-/*------------------------------------------------------------------------------4040+/*4141 * This is called once when the driver is unloaded to terminate the USB service.4242 * Context: process4343 */···4646 oz_hcd_term();4747}48484949-/*------------------------------------------------------------------------------4949+/*5050 * This is called when the USB service is started or resumed for a PD.5151 * Context: softirq5252 */···111111 return rc;112112}113113114114-/*------------------------------------------------------------------------------114114+/*115115 * This is called when the USB service is stopped or paused for a PD.116116 * Context: softirq or process117117 */···152152 }153153}154154155155-/*------------------------------------------------------------------------------155155+/*156156 * This increments the reference count of the context area for a specific PD.157157 * This ensures this context area does not disappear while still in use.158158 * Context: softirq···164164 atomic_inc(&usb_ctx->ref_count);165165}166166167167-/*------------------------------------------------------------------------------167167+/*168168 * This decrements the reference count of the context area for a specific PD169169 * and destroys the context area if the reference count becomes zero.170170 * Context: irq or process···180180 }181181}182182183183-/*------------------------------------------------------------------------------183183+/*184184 * Context: softirq185185 */186186int oz_usb_heartbeat(struct oz_pd *pd)···205205 return rc;206206}207207208208-/*------------------------------------------------------------------------------208208+/*209209 * Context: softirq210210 */211211int oz_usb_stream_create(void *hpd, u8 ep_num)···227227 return 0;228228}229229230230-/*------------------------------------------------------------------------------230230+/*231231 * Context: softirq232232 */233233int oz_usb_stream_delete(void *hpd, u8 ep_num)···250250 return 0;251251}252252253253-/*------------------------------------------------------------------------------253253+/*254254 * Context: softirq or process255255 */256256void oz_usb_request_heartbeat(void *hpd)
+11-13
drivers/staging/ozwpan/ozusbsvc1.c
···2222#include "ozhcd.h"2323#include "ozusbsvc.h"24242525-/*------------------------------------------------------------------------------2626- */2725#define MAX_ISOC_FIXED_DATA (253-sizeof(struct oz_isoc_fixed))28262929-/*------------------------------------------------------------------------------2727+/*3028 * Context: softirq3129 */3230static int oz_usb_submit_elt(struct oz_elt_buf *eb, struct oz_elt_info *ei,···5153 return ret;5254}53555454-/*------------------------------------------------------------------------------5656+/*5557 * Context: softirq5658 */5759int oz_usb_get_desc_req(void *hpd, u8 req_id, u8 req_type, u8 desc_type,···8890 return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0);8991}90929191-/*------------------------------------------------------------------------------9393+/*9294 * Context: tasklet9395 */9496static int oz_usb_set_config_req(void *hpd, u8 req_id, u8 index)···111113 return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0);112114}113115114114-/*------------------------------------------------------------------------------116116+/*115117 * Context: tasklet116118 */117119static int oz_usb_set_interface_req(void *hpd, u8 req_id, u8 index, u8 alt)···135137 return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0);136138}137139138138-/*------------------------------------------------------------------------------140140+/*139141 * Context: tasklet140142 */141143static int oz_usb_set_clear_feature_req(void *hpd, u8 req_id, u8 type,···161163 return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0);162164}163165164164-/*------------------------------------------------------------------------------166166+/*165167 * Context: tasklet166168 */167169static int oz_usb_vendor_class_req(void *hpd, u8 req_id, u8 req_type,···190192 return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0);191193}192194193193-/*------------------------------------------------------------------------------195195+/*194196 * Context: tasklet195197 */196198int oz_usb_control_req(void *hpd, u8 req_id, struct usb_ctrlrequest *setup,···239241 return rc;240242}241243242242-/*------------------------------------------------------------------------------244244+/*243245 * Context: softirq244246 */245247int oz_usb_send_isoc(void *hpd, u8 ep_num, struct urb *urb)···311313 return 0;312314}313315314314-/*------------------------------------------------------------------------------316316+/*315317 * Context: softirq-serialized316318 */317319static void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx,···355357356358}357359358358-/*------------------------------------------------------------------------------360360+/*359361 * This is called when the PD has received a USB element. The type of element360362 * is determined and is then passed to an appropriate handler function.361363 * Context: softirq-serialized···428430 oz_usb_put(usb_ctx);429431}430432431431-/*------------------------------------------------------------------------------433433+/*432434 * Context: softirq, process433435 */434436void oz_usb_farewell(struct oz_pd *pd, u8 ep_num, u8 *data, u8 len)